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); }
请帮忙。
I am creating an android app for jokes. I have multiple jokes which i want to share with whatsapp users.
Do i need write share intent individually for each jokes?
For Example:
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); }
please help.
原文:https://stackoverflow.com/questions/29116042
最满意答案
delete
Array
不会删除元素,它会将其设置为undefined
。 并且由于打印时undefined
导致空字符串,这解释了write()
的结果。您需要使用
splice()
来删除元素。 如果将它与indexOf
结合使用(您可能需要为旧浏览器定义它),您将得到一个非常短的函数:Array.prototype.remove = function (obj) { this.splice(this.indexOf(obj), 1); return this; }
PS:我不是扩大原生原型的倡导者......
delete
on anArray
will not remove the element, it will set it toundefined
. And sinceundefined
when printed results in an empty string, that explains the results ofwrite()
.You need to use
splice()
to remove the element. If you combine it withindexOf
(you may need to define it for older browser) you get a pretty short function:Array.prototype.remove = function (obj) { this.splice(this.indexOf(obj), 1); return this; }
PS: I'm not an advocate of expanding native prototypes...
相关问答
更多-
这样做的原因是,你每隔一个单位画一个正方形。 由于在此期间没有任何东西被清除,重叠的四边形形成一条线。 目前还不清楚你想要实现的目标。 翻译通常不会绘制多个四边形。 如果您正在尝试制作动画,则必须将移动分割为多个帧并在每个帧中精确绘制一个方格。 The reason for this is, that you draw squares every step units away from each other. Since nothing gets cleared in the meantime, the ...
-
我想它是这样的: “并非所有代码都返回值”。 如果是这样,只需添加 public static string GetContentFromSPList(string cValueToFind) { string cValueFound = ""; try { //code } catch (Exception ex) { } finally ...
-
你应该检查strdup的返回值。 如果内存分配遇到问题(例如内存不足),则temp获取值NULL 。 检查是否是这种情况并退出并显示错误消息。 您的if语句始终为false: if(isalpha(temp[i]) && isspace(temp[i])) temp[i]怎么可能是字母数字和空间? 还要注意(尽管这不是问题)这对于for而言是while (循环遍历数组的所有元素直到结束)。 使用预期的习语总是好的。 这也可以在适当的位置完成(不需要temp字符串): dirty[j] = dirty[i] ...
-
如果current->next->next == very_next = NULL ,那么当前也不会将当前的NULL分配为NULL ,从而使后来访问当前(通过current->next )无效( current = current->next = very_next )? If current->next->next == very_next = NULL, wouldn't current get assigned NULL as well, thus making the later access to ...
-
首先,您实际上并没有将随机数存储在数组中,因此它将全部为零。 至于你所看到的实际错误,你有一个经典的错误。 您有两种选择: right指向数组的末尾或指向数组末尾的指针。 任何一个都是有效的,但你把两者混合在一起。 具体来说,你传递的是1000,一个超过数组的末尾,为right值,但随后你立即用它索引数组,自然抛出一个异常。 First off, you aren't actually storing the random numbers in the array, so it will be all ze ...
-
delete Array不会删除元素,它会将其设置为undefined 。 并且由于打印时undefined导致空字符串,这解释了write()的结果。 您需要使用splice()来删除元素。 如果将它与indexOf结合使用(您可能需要为旧浏览器定义它),您将得到一个非常短的函数: Array.prototype.remove = function (obj) { this.splice(this.indexOf(obj), 1); return this; } PS:我不是扩大原生原型 ...
-
这个功能有什么问题?(What is wrong with this function?)[2023-11-15]
这个代码中有很多问题。 strlen和strlent,除非你有一个奇怪的库函数。 你正在堆栈上定义一个静态缓冲区。 这是一个潜在的错误(也是安全问题),因为稍后会将一行字符串复制到它而不检查长度。 可能的解决方案可以是在堆上分配内存(使用strlen和malloc的组合),也可以使用strncpy并接受字符串的切断。 附加'\ n'确实可以解决添加新行的问题,但是这会产生更多的错误,因为字符串当前不是空终止的。 解决方案:追加'\ n'和'\ 0'以终止新字符串。 正如其他人所提到的,你正在返回一个指向局部 ... -
你错过了if的return语句。 没有它,除了一个或一个零字符的字符串之外的任何东西最终都会返回false : public static boolean isPalindrome(String test) { if(test.length() <= 1) { // A more elegant check return true; } if (test.charAt(0) == test.charAt(test.length() - 1)) { ...
-
我的功能有什么问题(Whats wrong with my function)[2022-08-13]
我认为它是因为你在创建div标签之前加载js文件,将脚本放在正文的末尾并且应该修复它 I think its because you are loading the js file before the div tag its created, put the script at the end of the body and that should fix it -
在PowerShell中调用函数时,不要使用括号。 您应该像这样调用FooBarMeh: FooBarMeh $c $a $b 如果你用($c, $a, $b)调用它,那么你传递一个包含3个元素的数组。 该数组被分配给$in 。 (有趣的是,开关的作用类似于循环。它会针对数组中的每个项执行。我没想到。) 但请注意,当您调用.NET函数时,请使用括号。 例如: $a.Contains('A') You don't use parentheses when you call functions in Pow ...