【发布时间】:2017-06-20 19:31:44
【问题描述】:
我的问题与其他有关如何打开 YouTube 链接的问题不同。我的问题是如何打开 YouTube 链接,然后当它在应用程序中打开时,它应该关闭 YouTube 应用程序并再次调用我的 MainActivity,它会打开 YouTube 应用程序。但是,它应该从头开始打开 YouTube 应用,而不仅仅是显示在后台运行的上一个 YouTube 活动。
MainAcitivy --> SecondActivity --> Youtube --> ThirdActivity --> Youtube
但我希望 YouTube 应用从头开始重新加载。但目前,我正在获取之前打开的 YouTube 应用程序,该应用程序在后台。
主活动
Intent intent = new Intent(MainActivity.this,ThirdActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
第二个活动
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link)));
sleep(10000);
Intent intent=new Intent(getApplicationContext(),ThirdActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
第三个活动
sleep(5000);
Toast.makeText(getApplicationContext(),"third",Toast.LENGTH_SHORT).show();
Intent intent=new Intent(getApplicationContext(),SecondActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
我想每次都从头开始加载它,但它向我显示了它暂停的状态。如果您不理解我的问题,请随时发表评论,我将尝试详细说明。提前致谢。
【问题讨论】:
-
我认为不可能以编程方式控制您内部 youtube 应用程序的状态
标签: android android-intent hyperlink youtube