I was sure, it was working at initial stages. Fortunately because of version control, I could track down the problem, and it turned out to be very very simple one.
Obviously I googled for the problem, and the very common suggestion was assigning android:parentActivityName in AndroidManifest.xml as explained in HERE. But this was not my problem, I had done exactly as it says.
I also had another solution. The solution was manipulating the function onOptionsItemSelected
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
And because I had mentioned the parent activity properly, I expected it to work properly.
SO WHAT WAS THE MISTAKE I DID?
Well my mistake turned out to be, I placedreturn true;
in onOptionsItemSelected
So the solution was to use:
return false
OR
return super.onOptionsItemSelected(item);
No comments:
Post a Comment