首页 \ 问答 \ Android分享多个笑话的意图(Android share intent for multiple jokes)

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
更新时间:2022-01-24 10:01

最满意答案

delete Array不会删除元素,它会将其设置为undefined 。 并且由于打印时undefined导致空字符串,这解释了write()的结果。

您需要使用splice()来删除元素。 如果将它与indexOf结合使用(您可能需要为旧浏览器定义它),您将得到一个非常短的函数:

Array.prototype.remove = function (obj) {
    this.splice(this.indexOf(obj), 1);
    return this;
}

PS:我不是扩大原生原型的倡导者......


delete on an Array will not remove the element, it will set it to undefined. And since undefined when printed results in an empty string, that explains the results of write().

You need to use splice() to remove the element. If you combine it with indexOf (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:我不是扩大原生原型 ...
  • 这个代码中有很多问题。 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)) { ...
  • 我认为它是因为你在创建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 ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)