Performing stop of activity that is not resumed
来源:互联网 发布:归来 知乎 编辑:程序博客网 时间:2024/06/10 20:05
That doesn't seem right to me. The splash activity would now be the top activity in the stack, so the
HomeActivity
onStop lifecycle method would get called eventually. Coincidentally, I moved the startActivity
call for the splash activity from onCreate
to onResume
in the HomeActivity
, and the error goes away.
gps.showSettingsAlert();//inside this use startActivityForResult(new Intent().setClass(this, MainActivity.class), result_code);
Edit: your method should be in MainActivity.class not in Service as service don't have ui so no point of getting the result there.
public void showSettingsAlert(Context context){ AlertDialog.Builder alertdialog = new AlertDialog.Builder(context); alertdialog.setTitle("Oups ! pas de données GPS"); alertdialog.setMessage("GPS n'est pas activé sur votre appareil, voulez vous l'activer ?"); /* handling the buttons : */ alertdialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivityForResult(intent, RESULT_CODE_GPS); } }); // on pressing cancel button alertdialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertdialog.show(); }
参考:http://stackoverflow.com/questions/25867085/refreshing-activity-performing-stop-of-activity-that-is-not-resumed-error
http://stackoverflow.com/questions/21947675/android-4-4-2-java-lang-runtimeexception-performing-stop-of-activity-that-is
- Performing stop of activity that is not resumed #12
- Performing stop of activity that is not resumed
- Performing stop of activity that is not resumed
- Performing stop of activity that is not resumed
- Performing stop of activity that is not resumed:
- Android 4.4.2 - java.lang.RuntimeException: Performing stop of activity that is not resumed
- Android 报错Android - Performing stop of activity that is not resumed
- Android 报错Android - Performing stop of activity that is not resumed
- Performing stop of activity that is not resumed:使用AndroidAnnotations的常见注意事项
- java.lang.RuntimeException: Performing stop of activity that is not resumed OOM了也会造成之前Activity被系统杀掉
- “(null)” is of a model that is not supported by this version of Xcode. Ple
- “(null)” is of a model that is not supported by this version of Xcode. Please use a different device
- “(null)” is of a model that is not supported by this version of Xcode. Please use a different device
- “gjw” is of a model that is not supported by this version of Xcode. Please use a different device.
- Argument of '#selector' refers to instance method 'changeScale(byReactingTo:)' that is not exposed t
- Incorrect decrement of the reference count of an object that is not owned at this point by the calle
- Incorrect decrement of the reference count of an object that is not owned at this point by the calle
- Phone may be running a version of iOS that is not supported by this version of Xcode.
- ACM-大整数加法
- 出车祸一定要死吗
- lintcode——翻转链表
- rbac与auth权限认证的区别
- mybati缓存机制
- Performing stop of activity that is not resumed
- webservice接口调用OA方法
- 设置Activity的启动模式为singleTask接收不到intent的解决方法+启动模式为standard时,onNewIntent未被调用
- Python中的property, setter装饰器
- I
- k-d tree背诵用模板
- 机器学习系列博客
- lintcode——删除链表中的元素
- 简单轮播的实现