Settings之后回到主界面
有时候想要进行系统设置,但是系统设置之后不能回到主界面
这时候一般需要在onResume()中执行
?
@Override?public void onResume(){?? ? super.onResume();?? ? // 检查是否连接? ? if ( isOnline ){?? ? ? ? // 是 如何?? ? }else{?? ? ? ? ? ? ? ? new AlertDialog.Builder(SplashScreen.this)?? ? ? ? ? ? .setTitle("Connection failed")?? ? ? ? ? ? .setMessage("This application requires network access. Please, enable " +?? ? ? ? ? ? ? ? ? ? "mobile network or Wi-Fi.")?? ? ? ? ? ? .setPositiveButton("Accept", new DialogInterface.OnClickListener() {?? ? ? ? ? ? ? ? @Override?? ? ? ? ? ? ? ? public void onClick(DialogInterface dialog, int which) {?? ? ? ? ? ? ? ? ? ? // 需要做点什么
? ? ? ? ? ? ? ? ? ? SplashScreen.this.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));?? ? ? ? ? ? ? ? }?? ? ? ? ? ? })?? ? ? ? ? ? .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {?? ? ? ? ? ? ? ? @Override?? ? ? ? ? ? ? ? public void onClick(DialogInterface dialog, int which) {?? ? ? ? ? ? ? ? ? ? SplashScreen.this.finish();?? ? ? ? ? ? ? ? }?? ? ? ? ? ? })?? ? ? ? ? ? .show();?? ? }?}?
startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS)?
这个事设置的主方法