package com.BackButton;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;
public class AndroidBackButtonActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
Toast.makeText(AndroidBackButtonActivity.this,
"BACK key pressed",
Toast.LENGTH_LONG).show();
}
}
Related Post:
- Handle the BACK key by overriding onKeyDown() (For Android OS version before API level 5)
0 Response to "Handle the BACK key by overriding onBackPressed()"
Posting Komentar