onclicklistener - Android ImageButton click not working sometimes -


i'm using imagebutton in xml, this:

<framelayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centervertical="true"         >         <imagebutton             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:id="@+id/imagebutton_home"             android:src="@drawable/home_icon"             android:background="@android:color/transparent"             android:layout_alignparentleft="true"             android:layout_marginleft="10dp"             android:focusableintouchmode="false"             android:focusable="false"             android:clickable="true"             />          <imagebutton             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:id="@+id/imagebutton_back"             android:src="@drawable/back_icon"             android:layout_alignparentleft="true"             android:layout_marginleft="10dp"             android:background="@android:color/transparent"             android:visibility="gone"             android:focusableintouchmode="false"             android:focusable="false"             android:clickable="true"             />      </framelayout> 

only 1 image button visible @ time. , i'm capturing click in java code following:

  imagebuttonhome.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             intent homeintent = new intent(settingsactivity.this, mainactivity.class);             startactivity(homeintent);         }     }); 

this works fine sometimes, not always. see line in logcat whenever click on image button:

d/viewrootimpl: viewpostimeinputstage action_down 

this line shows up, when imagebutton click action not performed.

but when imagebutton click works correctly, other line adds log:

 d/viewrootimpl: viewpostimeinputstage action_down  d/abslistview: motionrecognitionmanager 

i want image button work every time. please help.

give padding imagebuttons in order capture touch event.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -