Search code examples
androidandroid-intentsettingsandroid-wifi

startActivityForResult - WIFI Settings Don't Go Back To App


I'm starting an intent to Settings - Wireless, the problem was whenever I press KeyBack. It will not go back to my App, instead It closes it.

wifiManagerCheck = (WifiManager)getSystemService(Context.WIFI_SERVICE);

    if (!checkWifiEnabledSwitch(wifiManagerCheck)){
        //NOTIFY THROUGH SNACK BAR ACTION TO SETTINGS
        Snackbar.make(findViewById(android.R.id.content),"No internet",Snackbar.LENGTH_LONG)
                .setAction("Turn on", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivityForResult(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS), 0);
            }
        }).show();
    }

Is this correct? I base this one in this link:

startActivityForResult(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS), 0); 

Solution

  • check in the for the activity, is there something like noHistory=true?