【发布时间】:2015-10-01 01:24:58
【问题描述】:
我还是 Android 开发的新手,我即将在 google play 商店发布我的第一个应用程序。
我的应用中有一个按钮,它是一个分享按钮。当用户点击它时,我希望它分享我的应用程序的 google play 链接。但我不知道如何获取我的应用的 google play 链接。
在shareBody 行中,我希望它包含我的应用程序的谷歌播放链接。我从这个网站得到了以下代码,所以我不太明白发生了什么:P。
public void ShareClick(View view){
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "https://play.google.com/store";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Download XXXXXX");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
例如:
String shareBody = "https://play.google.com/store";
我想要的是:
String shareBody = "google play link of my app";
谁能告诉我该怎么办?
P.S 在我的手机上测试我的应用程序期间,每当我进入主菜单或按下多任务按钮然后返回我的应用程序时,它就会崩溃
我能做些什么来防止这种情况发生吗?谢谢一百万!
【问题讨论】: