Android 分享多个笑话的意图
Android share intent for multiple jokes
我正在创建一个 android 笑话应用程序。我有多个笑话想与 whatsapp 用户分享。
我需要为每个笑话单独写分享意图吗?
例如:
public void share(View view)
{
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,
"Q: What did the butcher say when he backed into the meat-grinder?
A: Looks like I'm getting a little behind in my work!");
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
请帮忙。
为了方便理解,把Intent当成一个快递员,帮你把数据从Activity1传送到Activity2。
在这种情况下,您可以尝试一个简单的方法:将您的笑话放在一个字符串中:
String joke = "Q: What did the butcher say when he backed into the meat-grinder?\n
A: Looks like I'm getting a little behind in my work!";
sendIntent.putExtra(Intent.EXTRA_TEXT,joke);
当您改进 Java
时,享受尝试其他方式的乐趣
我正在创建一个 android 笑话应用程序。我有多个笑话想与 whatsapp 用户分享。
我需要为每个笑话单独写分享意图吗?
例如:
public void share(View view)
{
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,
"Q: What did the butcher say when he backed into the meat-grinder?
A: Looks like I'm getting a little behind in my work!");
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
请帮忙。
为了方便理解,把Intent当成一个快递员,帮你把数据从Activity1传送到Activity2。
在这种情况下,您可以尝试一个简单的方法:将您的笑话放在一个字符串中:
String joke = "Q: What did the butcher say when he backed into the meat-grinder?\n
A: Looks like I'm getting a little behind in my work!";
sendIntent.putExtra(Intent.EXTRA_TEXT,joke);
当您改进 Java
时,享受尝试其他方式的乐趣