문제

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);
}
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top