Je veux spécifier dans mon code pour passer à une activité spécifique après avoir appuyé sur le bouton de retour sur un clavier android. Comment puis-je accomplir cela? Des amis m'aident.Comment passer à une activité spécifique après avoir appuyé sur le clavier Android (0 android)
Maintenant, j'ai trouvé la solution avec l'aide de nos amis.
J'ai trouvé la solution à mon problème. onBackPressed()
fonctionne après la version 1.6. Pour les versions précédentes, nous avons besoin d'utiliser public boolean onKeyDown(int keyCode, KeyEvent event)
méthode
Mon code pour ce problème résolu est
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.CUR_DEVELOPMENT
&& keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
// Take care of calling this method on earlier versions of
// the platform where it doesn't exist.
onBackPressed();
}
return super.onKeyDown(keyCode, event);
}
//@Override
public void onBackPressed() {
// This will be called either automatically for you on 2.0
// or later, or by the code above on earlier versions of the
// platform.
Intent i=new Intent(AgesWebViewIndex.this,TabCls.class);
i.putExtra("age", "agepage");
startActivity(i);
return;
}
merci u mon frnd J'espère que cela résoudra mon prob je vais essayer maintenant –