Android Application Development Cookbook: 93 Recipes for Building Winning Apps



Download 32,34 Mb.
Pdf ko'rish
bet35/56
Sana26.02.2022
Hajmi32,34 Mb.
#470540
1   ...   31   32   33   34   35   36   37   38   ...   56
Bog'liq
Android Application Development Cookbook

26

ChAPter 1
Android FundAmentAls
sending e-mail
To send an e-mail message from within your application, use the following code snippet:
Intent i = new Intent(Intent.ACTION_SEND); 
i.setData(Uri.parse("mailto:"));
String[] to = { "someone1@example.com" , "someone2@example.com" };
String[] cc = { "someone3@example.com" , "someone4@example.com" }; 
i.putExtra(Intent.EXTRA_EMAIL, to); 
i.putExtra(Intent.EXTRA_CC, cc); 
i.putExtra(Intent.EXTRA_SUBJECT, "Subject here..."); 
i.putExtra(Intent.EXTRA_TEXT, "Message here..."); 
i.setType("message/rfc822"); 
startActivity(Intent.createChooser(i, "Email"));
Figure 1-10 shows the E-mail application displaying the content of the e-mail. 
Figure 1-10 
www.it-ebooks.info


 
Recipe 1.7 calling Built-in Apps

27
sending content to other Apps
Occasionally, you may want to launch another activity and send some content to it. For example, 
you might want to send some content to Facebook as well as the E-mail application. In this case, 
instead of targeting a particular application to invoke, you can use the generic 
ACTION_SEND
con-
stant to invoke a list of applications from which to choose. Consider the following code snippet:
Intent i = new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Subject...");
i.putExtra(Intent.EXTRA_TEXT, "Text...");
startActivity(Intent.createChooser(i, "Apps that can respond to this"));
When run on a real device, the preceding code might invoke the list of applications shown in 
Figure 1-11. 
If you selected the Messaging app, the data you set in the 
Intent
object will then be sent as an 
SMS message (see Figure 1-12).

Download 32,34 Mb.

Do'stlaringiz bilan baham:
1   ...   31   32   33   34   35   36   37   38   ...   56




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish