【发布时间】:2020-03-02 05:26:30
【问题描述】:
我尝试为想要关注的用户打开我的 Instagram 页面。我尝试了一些代码来完成这项工作:
private void followInsta() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://www.instagram.com/motivationalquotes.app"));
try {
intent.setPackage("com.instagram.android");
startActivityForResult(Intent.createChooser(intent, mContext.getResources().getString(R.string.app_name)), 1000);
} catch (Exception e) {
try {
Log.e("FollowInsta1>>>", Log.getStackTraceString(e));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivityForResult(Intent.createChooser(intent, mContext.getResources().getString(R.string.app_name)), 1000);
} catch (Exception ex) {
Log.e("FollowInsta2>>>", Log.getStackTraceString(ex));
}
}
}
我从 click 事件中调用了它,但它始终打开对话框,并显示一条消息我的应用名称和“没有应用可以执行此操作”
这仅发生在三星 Galaxy J8 设备上。但它通常适用于其他设备。如果有人知道要为这些类型的设备尝试什么,请告诉我。我也试过this 来解决我的问题,但是没有用!
【问题讨论】:
标签: android