简体   繁体   English

意图动作在隐式意图中不起作用吗?

[英]Intent Action doesn't work in implicit intent?

Intent n = new Intent("com.bushraod.sendM.hom");
n.putExtra("name", nam);
startActivityForResult(n, 1);

I wrote this code and it doesn't work to move to another activity. 我编写了这段代码,因此无法进行其他活动。

For moving to another activity, use something like this. 要进行其他活动,请使用类似以下的内容。

Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra("name", name);
intent.setPackage("com.bushraod.sendM.hom"); //Package name of the application you are trying to open
startActivity(sendIntent);

To navigate to another activity, you can just do the following: 要导航到另一个活动,您可以执行以下操作:

Intent n = new Intent(this, ActivityThatYouWantToGoTo.class);
n.putExtra("dataThatYouWantToPass", data);
startActivity(n); 
Intent intent=new Intent(Intent.ACTION_VIEW);  
intent.setPackage("com.bushraod.sendM.hom");
intent.putExtra("name", nam);
startActivityForResult(intent, 1001);

Note: Please try with this. 注意:请尝试与此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM