我必須發佈文本和電子郵件到FB,TW和電子郵件。分享Fb,Tw和電子郵件使用Intent.action_SEND在android
在這裏,我已經創建了一個imageview.if我不得不clcik這些imageview的手段警告dislog框opening.Here以下3項所列:FB,TW,電子郵件
這裏,如果我要在FB警報列表,這意味着它是去FB應用程序使用action_send ...也張貼的文字和圖像。其他TW和電子郵件應用程序隱藏。
如果我ahve點擊TW提示列表意味着它是去Tw到應用程序,並張貼在同一時間隱藏FB,電子郵件應用程序中的文本和圖像...
我該怎麼辦? ?
請幫我..我已經使用下面的代碼...在這裏,我要點擊FB意味着什麼都沒有發生?請給我解決這些......我的設備安裝了FB,TW應用程序也......那麼爲什麼什麼都沒有發生?請給我建議?我的代碼有什麼問題?
ImageView share = (ImageView) findViewById(R.id.imageView5);
share.setOnClickListener(new OnClickListener()
{
public void onClick ( final View v)
{
final CharSequence[] items =
{
"Facebook", "Twitter", "Email"
};
AlertDialog.Builder builder = new AlertDialog.Builder(SubCate.this);
builder.setTitle("Share Via:");
builder.setItems(items, new DialogInterface.OnClickListener()
{
public void onClick (DialogInterface dialog , int item)
{
if (items[item] == "Facebook")
{
initShareIntent("facebook");
}
if(items[item] == "Twitter"){
initShareIntent("twitter");
}
if (items[item] == "Email")
{
initShareIntent("gmail");
}
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
}
private void initShareIntent(String type) {
boolean found = false;
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("image/jpeg");
// gets the list of intents that can be loaded.
List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(share, 0);
if (!resInfo.isEmpty()){
for (ResolveInfo info : resInfo) {
if (info.activityInfo.packageName.toLowerCase().contains(type) ||
info.activityInfo.name.toLowerCase().contains(type)) {
share.putExtra(Intent.EXTRA_SUBJECT, _Substring);
share.putExtra(Intent.EXTRA_TEXT, _Substring);
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(_Image));
share.setPackage(info.activityInfo.packageName);
found = true;
break;
}
}
if (!found)
return;
startActivity(Intent.createChooser(share, "Select"));
}
}
編輯:
這裏,我已經運行應用程序:
如果我必須點擊Fb的手段Facebook塗鴉牆被打開......但文本不在這裏顯示..
如果我ahev點擊Tw意味着twitter牆正在打開... Twitter文本顯示在牆上..但圖像是不能加載的消息顯示....
如果我必須點擊電子郵件意味着gmail正在打開,並且還顯示主題上的文字以及...
爲什麼圖像無法加載消息正在顯示...也FB文本和圖像不顯示?? ??請給我解決這些?
是的,我已經這樣做過了..我希望通過action_send ly.thats發展,我已經發布了 – user2218667 2013-04-22 07:26:38
好的。我有一個建議,如果你有列表發佈fb,twitter等,那麼爲什麼你需要按鈕,然後點擊event.your希望開發這種方式確定。 – 2013-04-22 08:18:33