title: Android ImageButton ClickEvent not working
body: <p>here is the code, please can anyone simply tell me how to make the onClick event run?</p>
  
  <p>xml file of the activity, which has a navigation-drawer fragment, An Image view, A TextView, An ImageButton</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
  
      &lt;include
          android:id="@+id/app_bar"
          layout="@layout/app_bar" /&gt;
  
  
      &lt;ImageView
          android:id="@+id/imageView"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignTop="@+id/drawer_layout"
          android:adjustViewBounds="true"
          android:contentDescription="@string/ContentDescriptionProfileImage"
          android:src="@drawable/profile_pic" /&gt;
  
      &lt;LinearLayout
          android:id="@+id/linearLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/imageView"
          android:background="#FFFFFF"
          android:orientation="horizontal"
          android:padding="5dp"&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="45dp"&gt;
  
              &lt;TextView
                  android:id="@+id/textView"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true"
                  android:layout_gravity="center_vertical"
                  android:padding="3dp"
                  android:text="@string/profileName"
                  android:textColor="#000000"
                  android:textSize="18sp"
                  android:textStyle="bold" /&gt;
  
          &lt;ImageButton
              android:id="@+id/profileSettings"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:layout_alignParentEnd="true"
              android:layout_alignParentRight="true"
              android:background="@null"
              android:contentDescription="@string/settingsIconDescription"
              android:padding="8dp"
              android:onClick="onSettingsIconPressed"
              android:src="@drawable/settings32" /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/LinearLayout&gt;
  
  
      &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:id="@+id/drawer_layout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_below="@+id/app_bar"&gt;
  
          &lt;fragment
              android:id="@+id/fragment_navigation_drawer"
              android:name="studio25.materialdesign.NavigationDrawerFragment"
              android:layout_width="280dp"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              app:layout="@layout/fragment_navigation_drawer"
              tools:layout="@layout/fragment_navigation_drawer"&gt;&lt;/fragment&gt;
  
      &lt;/android.support.v4.widget.DrawerLayout&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The image of the Screen Looks like <a href="http://s9.postimg.org/8rjrs1267/screen_Shot.png" rel="nofollow">this</a></p>
  
  <p>here is the activity class</p>
  
  <pre><code>package studio25.materialdesign;
  
  import android.annotation.TargetApi;
  import android.os.Build;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.support.v7.widget.PopupMenu;
  import android.support.v7.widget.Toolbar;
  import android.view.ContextMenu;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ImageButton;
  import android.widget.Toast;
  
  
  public class ProfileView extends ActionBarActivity {
  
      private Toolbar toolbar;
      String title = "";
      ImageButton setttingsButton;
  
      @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_profile_view);
          toolbar = (Toolbar) findViewById(R.id.app_bar);
          setSupportActionBar(toolbar);
  
          this.getSupportActionBar().setTitle(title);
          getSupportActionBar().setDisplayShowHomeEnabled(true);
  
  
          NavigationDrawerFragment drawerFragment = (NavigationDrawerFragment)
                  getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
          drawerFragment.setUp((DrawerLayout) findViewById(R.id.drawer_layout), toolbar);
  
          setttingsButton= (ImageButton) findViewById(R.id.profileSettings);
  
  
          /*
          Window window = this.getWindow();
          window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
          window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
          window.setStatusBarColor(this.getResources().getColor(R.color.primaryColor));
          */
      }
  
  
      public void onSettingsIconPressed(View v)
      {
          /*
          PopupMenu popupMenu=new PopupMenu(this,v);
          MenuInflater inflater=getMenuInflater();
          inflater.inflate(R.menu.profile_settings_popup_menu,popupMenu.getMenu());
          popupMenu.show();
          */
  
          Toast.makeText(this,"Event Click Occured",Toast.LENGTH_SHORT).show();
      }
  
  }
  </code></pre>
  
  <p>I basically wanted a menu popup on buttonclick, but on debugging realized that my button click is not itself working.  </p>
  
  <p>Some tutotials say for popUp menu , minSdkVersion should be 11, even changed that.</p>
  
  <p>Nothing is helping me.
  Is my xml erroneous or what? </p>