This is XML file code piece:
<ImageView
android:id="@+id/ivh4c5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"
android:src="@drawable/logoutmenu" />
This is code piece:
logOut.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v)
{
final SharedPreferences prefs = getApplicationContext().getSharedPreferences("ProfileName", MODE_PRIVATE);
Editor editor = prefs.edit();
editor.clear();
editor.commit();
finish();
}});
Result:
On clicking logout image application must logout (only on first time).
Problem:
Clicking on logout image do not respond on first click , I have to click it again in order to logout from application.
Please provide corrected code.