读书人

Settings以后回到主界面

发布时间: 2012-08-25 10:06:20 作者: rapoo

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)?
这个事设置的主方法

读书人网 >移动开发

热点推荐