posts - 71,  comments - 203,  trackbacks - 0









//  07-27 15:53:08.061: INFO/ActivityManager(2460): Starting activity: Intent { act=android.intent.action.CHOOSER cmp=android/ (has extras) }
//  07-27 15:53:08.846: INFO/ActivityManager(2460): Displayed activity android/ 771 ms (total 771 ms)
//  07-27 15:53:21.592: INFO/ActivityManager(2460): Starting activity: Intent { act=android.intent.action.SEND typ=image/jpeg flg=0x3000000 (has extras) }


Activity Action: Display an activity chooser, allowing the user to pick what they want to before proceeding. This can be used as an alternative to the standard activity picker that is displayed by the system when you try to start an activity with multiple possible matches, with these differences in behavior:
You can specify the title that will appear in the activity chooser.
The user does not have the option to make one of the matching activities a preferred activity, and all possible activities will always be shown even if one of them is currently marked as the preferred activity.
This action should be used when the user will naturally expect to select an activity in order to proceed. An example if when not to use it is when the user clicks on a "mailto:" link. They would naturally expect to go directly to their mail app, so startActivity() should be called directly: it will either launch the current preferred app, or put up a dialog allowing the user to pick an app to use and optionally marking that as preferred.
In contrast, if the user is selecting a menu item to send a picture they are viewing to someone else, there are many different things they may want to do at this point: send it through e-mail, upload it to a web service, etc. In this case the CHOOSER action should be used, to always present to the user a list of the things they can do, with a nice title given by the caller such as "Send this photo with:".
As a convenience, an Intent of this form can be created with the createChooser(Intent, CharSequence) function.

3.好吧,现在搜索吧,关键字:  Android 分享

Intent intent=new Intent(Intent.ACTION_SEND);  基本上都有这个语句,好,再搜这个吧。找个几次基本上就能找到了


<activity android:name=".Writer_Blog" android:label="share to weibo">
<action android:name="android.intent.action.SEND">
<category android:name="android.intent.category.DEFAULT">
<data android:mimeType="image/*">//这里是要接收send的类型

这是我自己的微博应用。label是要弹出来的分享列表的文字。<action android:name="android.intent.action.SEND"> 这个就是Intent.ACTION_SEND了。


                          Intent it = getIntent();
if (it != null &&  it.getAction() != null && it.getAction().equals(Intent.ACTION_SEND)) {
Bundle extras = it.getExtras();
if (extras.containsKey("android.intent.extra.STREAM")) {
Log.i(TAG, "uri++=" + extras.get("android.intent.extra.STREAM"));
uri = (Uri) extras.get("android.intent.extra.STREAM");
// 07-27 17:39:44.073: INFO/Writer_Blog(3289): android.intent.extra.STREAM=content://media/external/images/media/1211

网上找到的代码,能获取所有manifest文件里面加了<action android:name="android.intent.action.SEND"> apps

public List<ResolveInfo> getShareTargets(){
List<ResolveInfo> mApps = new ArrayList<ResolveInfo>();
Intent intent=new Intent(Intent.ACTION_SEND,null);
PackageManager pm=this.getPackageManager();
return mApps;




Intent intent = new Intent(Intent.ACTION_VIEW);
2 intent.setData(Uri.parse("market://details?id=" + getPackageName()));
3 startActivity(intent);


Intent intent = new Intent(Intent.ACTION_VIEW);
2 intent.setData(Uri.parse("market://search?q=pub:Your Publisher Name"));
3 startActivity(intent);
posted on 2011-07-27 20:17  stay  阅读(8259)  评论(0编辑  收藏