在我的应用中,它们不是FragmentActivity.java,但是崩溃报告给我以下错误
Fatal Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms&pcampaignid=gcore_8487000--- flg=0x80000 pkg=com.android.vending }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1647)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3415)
at android.app.Activity.startActivityForResult(Activity.java:3376)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
at android.app.Activity.startActivity(Activity.java:3611)
at android.app.Activity.startActivity(Activity.java:3579)
at com.google.android.gms.dynamic.zza$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17373)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5056)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(NativeStart.java)
我不知道问题出在什么地方,实际在哪里以及在大多数情况下在Redmi手机中发生此崩溃
最佳答案
如果设备未安装Google Play(如果没有Activity
来处理此intent
),则会发生异常-在这种情况下,您可以尝试在browser
中打开网址:
您可以使用Google Play套件名称:com.android.vending
String pakcage_name="com.android.vending";
public static void open_google_play(Context context) {
try {
//open in play store app directly
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pakcage_name)));
} catch (android.content.ActivityNotFoundException e) {
//open in browser
openBrowser(context, "https://play.google.com/store/apps/details?id=" + pakcage_name);
}
}
public static void openBrowser(Context context, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (null != intent.resolveActivity(context.getPackageManager())) {
context.startActivity(intent);
}
}
在
button
期间使用它,请单击以编写此方法:open_google_play(Activity.this);
关于android - Android应用程式在FragmentActivity.java上当机。android.support.v4.app.FragmentActivity.startActivityForResult,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41950805/