2011-12-29 20 views

Odpowiedz

40

Można zrobić to samo za pomocą:

Intent i=new Intent(android.content.Intent.ACTION_SEND); 
i.setType("text/plain"); 
i.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject test"); 
i.putExtra(android.content.Intent.EXTRA_TEXT, "extra text that you want to put"); 
startActivity(Intent.createChooser(i,"Share via")); 

Szczegółowe przykładem jest tutaj dla odniesienia: http://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/

+0

Hi @Paresh Mayani, hej fajne rozwiązanie mogę dodać więcej opcji niestandardowych w tym oknie dialogowym createChooser? – andrewww

1

dzielenia treści poprzez:

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); 

//set type 

shareIntent.setType("text/plain"); 

//add what a subject you want 

shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"add what a subject you want"); 

String shareMessage="message body"; 

//message 

shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,shareMessage); 

//start sharing via 

startActivity(Intent.createChooser(shareIntent,"Sharing via")); 
Powiązane problemy