Reputation: 1424
I have implemented presently back button like below
<Button
android:id="@+id/back"
style="@style/NavButtons"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:background="@drawable/back"
android:onClick="finishActivity"
android:paddingLeft="5dp" />
and in code i am doing
public void finishActivity(View v) {
finish();
}
But the back button i have implemented doesnt work similar to device back button. what i should make my back button implementation work similar to device back button?
Thanks:)
Upvotes: 1
Views: 197
Reputation: 72613
You can use this:
super.onbackpressed();
if you want to do the same as the devices back button, just programmatically.
Upvotes: 4
Reputation: 7881
Refer android developer site for activity stack
http://developer.android.com/design/patterns/app-structure.html http://developer.android.com/design/patterns/navigation.html
Upvotes: 0