我正在尝试通过代码将 Vine ( https://vine.co/ ) Android 应用程序打开到特定的个人资料页面。我一直在尝试通常的方法,通过 URI 没有运气。这是我当前的非功能代码:
public void vineButtonClicked(View view)
{
Intent vineIntent = getVineIntent(view.getContext(), VINE_PROFILE_ID);
try {
startActivity(vineIntent);
} catch(Exception e) {
// getVineIntent() doesn't fail on returning a new intent with
// the vine:// URI, so this catches the failed intent. Why
// doesn't getVineIntent fail?
Toast.makeText(view.getContext(), "Vine is not installed!", Toast.LENGTH_SHORT).show();
}
}
public Intent getVineIntent(Context context, String userProfile) {
try {
return new Intent(Intent.ACTION_VIEW,
Uri.parse("vine://user/".concat(userProfile)));
} catch (Exception e) {
return getWebViewIntent("http://vine.co");
}
}
我尝试将 vine:// 换成 twitter:// URI 方案,它按预期工作。我怎样才能使这项工作?