Android 通过已安装的应用程序发送消息
我想分享我的android应用程序的url。我想通过我设备中安装的应用程序(蓝牙、facebook、谷歌邮件、消息等)共享此url 下面是代码Android 通过已安装的应用程序发送消息,android,Android,我想分享我的android应用程序的url。我想通过我设备中安装的应用程序(蓝牙、facebook、谷歌邮件、消息等)共享此url 下面是代码 import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Bu
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class SendURL extends Activity {
/** Called when the activity is first created. */
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button) findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent picMessageIntent = new Intent(
android.content.Intent.ACTION_SEND);
picMessageIntent.setType("plain/text");
/**
* //Code for sending image
* picMessageIntent.setType("image/jpeg"); File downloadedPic =
* new
* File("/sdcard/download/"+"1287567819_Einstein_1_JPEG.jpg");
* picMessageIntent.putExtra(Intent.EXTRA_STREAM,
* Uri.fromFile(downloadedPic));
*/
startActivity(Intent.createChooser(picMessageIntent,
"Send your url using:"));
}
});
}
}
当我按下一个名为share的按钮时,手机中可以共享此url的已安装应用程序应该如下所示。用户可以从此列表中选择一个应用程序,并通过所选应用程序(gmail、facebook、消息等)共享url。
根据给定的代码,我只能得到gmail和蓝牙。我不获取facebook、消息等。请告知,以便我可以通过手机中所有能够这样做的应用程序发送url
在此方面的任何帮助都将不胜感激。
期待,
关于尝试添加一个主题和一些文本-此时您没有共享url,只是创建一条空白消息 试着这样做:
Intent picMessageIntent = new Intent(
android.content.Intent.ACTION_SEND);
picMessageIntent.putExtra(Intent.EXTRA_SUBJECT, "my url subject");
picMessageIntent.putExtra(Intent.EXTRA_TEXT, "Go to url: "+"http://google.com/");
picMessageIntent.setType("plain/text");
startActivity(Intent.createChooser(picMessageIntent, "Send your url using:"));
替换
“我的url主题”
和“转到url”+“http://google.com/“
带有您希望共享的主题和url。好的。谢谢。我会检查您告诉我的方式。我再次确认。我需要通过手机中已安装和默认的应用程序(facebook、消息等)发送它。”尝试添加一个主题和一些文本-此时您没有共享url,只是创建一条空白消息。我试过了,但facebook和消息仍然没有显示在chooser中,如图所示-。请提供建议。任何知道这一点的android专家,请帮助。我不知道为什么我没有从这个论坛获得足够的支持。这不是我第一次来这里。我确信我在这里提出的问题在技术上是可行的。我寻求的只是一些专家的支持。在大量的谷歌搜索之后,我在这里寻求专家的支持。StackOverflow,请满足我们的期望。。。