簡體   English   中英

意圖動作在隱式意圖中不起作用嗎?

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

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

我編寫了這段代碼,因此無法進行其他活動。

要進行其他活動,請使用類似以下的內容。

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);

要導航到另一個活動,您可以執行以下操作:

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);

注意:請嘗試與此。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM