Pergunta

I have created an app that redirects you to the systems alarm app. But the problem is that after redirecting to the alarm page when we press back it goes to the clock app i dont want this to happen How can i redirect from another app to my app.

manifest.xml

<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

NavigationDrawerFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }

    if (item.getItemId() == R.id.action_example) {
        Toast.makeText(getActivity(), "Starting Alarm Manager.", Toast.LENGTH_SHORT).show();
        Intent al = new Intent(AlarmClock.ACTION_SET_ALARM); 
        startActivity(al); 
        return true;
    }

    return super.onOptionsItemSelected(item);
}
Foi útil?

Solução

You cannot. Once you have opened another App (the clock app), that app is the current running app on the device. It is now in control of how buttons work and what the back button will do.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top