¾È±Ô °øºÎ¹æ

Android > ÀÎÅÙÆ®(Intent) - ¿¢½ºÆ®¶ó(Extra)

µî·ÏÀÏ : 2017-07-05 11:31 Á¶È¸¼ö : 53,110

1. ¿¢½ºÆ®¶ó(Extra)

ÀÎÅÙÆ®´Â ¿¢½ºÆ®¶ó¿¡ ÇÊ¿äÇÑ °ªÀ» ÀÔ·ÂÇÏ¸é ¾Èµå·ÎÀ̵å´Â ¿¢½ºÆ®¶ó¸¦ bundle °´Ã¼·Î º¯È­½ÃÅ°°Ô µÈ´Ù.

¹øµé °´Ã¼´Â ÀÎÅÙÆ®¸¦ »ç¿ëÇÏ¿© ´Ù¸¥ ¾ÖÇø®ÄÉÀ̼ÇÀÇ ¾×ƼºñƼ¿¡°Ô Àü´ÞµÈ´Ù.

±×¸®°í ¾×ƼºñƼÀÇ onCreate() Äݹé¸Þ¼­µåÀÇ ¸Å°³º¯¼ö·Î Á¦°ø ¹Þ°Ô µÈ´Ù.

¾×¼ÇµéÀÌ Æ¯º°ÇÑ Á¾·ùÀÇ ÀÚ·áµé°ú ÇÑ ÆÀÀ» ÀÌ·çµíÀÌ, ¾Æ·¡¿Í °°ÀÌ Æ¯Á¤ÇÑ ¿¢½ºÆ®¶óµé°úµµ ¿ª½Ã ÇÑ ÆÀÀ» ÀÌ·ç°Ô µÈ´Ù.

- ACTION_TIMEZONE_CHANGED ¾×¼ÇÀº »õ·Î¿î ½Ã°£´ë¸¦ ³ªÅ¸³»´Â 'time-zone' ¿¢½ºÆ®¶ó¸¦ Á¦°øÇØ¾ß ÇÑ´Ù.

- ACTION_HEADSET_PLUG ¾×¼ÇÀº Çìµå¼ÂÀÇ Å¸ÀÔ¿¡ ´ëÇÑ 'name' ¿¢½ºÆ®¶ó »Ó¸¸ ¾Æ´Ï¶ó, Çìµå¼ÂÀÌ ¹æ±Ý ¿¬°áµÇ¾ú´ÂÁö

¾Æ´Ï¸é Á¦°Å µÇ¾ú´ÂÁö¸¦ °¡¸®Å°´Â 'state' ¿¢½ºÆ®¶ó¸¦ Á¦°øÇØ¾ß ÇÑ´Ù.


ÀÎÅÙÆ® °´Ã¼¸¦ ¸¸µé¶§¿¡´Â ¿¢½ºÆ®¶óÀÇ ´Ù¾çÇÑ Å¸ÀÔ°ú °ü°è¾øÀÌ µ¿ÀÏÇÑ putExtra() ¸Þ¼­µå¸¦ »ç¿ëÇÑ´Ù.

¹Ý¸é¿¡ ÀÐÀ» ¶§¿¡´Â °¢°¡ ŸÀÔº°·Î get<º¯¼öŸÀÔ>Extra(Extra ¸í)ÀÇ Æ¯Á¤ÇÑ ¸Þ¼­µå¸¦ »ç¿ëÇؾßÇÑ´Ù.


- putExtra(EXTRA_NAME, "À̸§")À» »ç¿ëÇÏ¿´´Ù¸é getStringExtra(EXTRA_NAME)¸Þ¼­µå¸¦ »ç¿ëÇÏ¿© ¹®ÀÚ¿­À» ÀÐ°Ô µÈ´Ù.

- Á¤¼ö(int) ŸÀÔÀº putExtra(EXTRA_INT, value)À¸·Î ÀÔ·ÂÇÏ°í getIntExtra(EXTRA_INT)À»·Î Àд´Ù.

- Boolean ŸÀÔÀº putExtra(EXTRA_BOOLEAN, value)À¸·Î ÀÔ·ÂÇÏ°í getBooleanExtra(EXTRA_BOOLEAN)À¸·Î Àд´Ù.
 

	// À̸ÞÀÏ Àü¼Û
	Intent intent = new Intent(Intent.ACTION_SEND);
	String[] tos = {"aaa@gmail.com"};
	String[] ccs = {"bbb@gmail.com"};
	intent.putExtra(Intent.EXTRA_EMAIL, tos);
	intent.putExtra(Intent.EXTRA_CC, ccs);
	intent.putExtra(Intent.EXTRA_TEXT, "À̸ÞÀÏ ³»¿ë");
	intent.putExtra(Intent.EXTRA_SUBJECT, "À̸ÞÀÏ Á¦¸ñ");
	intent.setType("message/rfc882");
	intent.createChooser(intent, "Choose Email Client");

	// SMS Àü¼Û
	Uri smsUri = Uri.parse("tel:010-1234-5678");
	intent = new Intent(Intent.ACTION_SEND, smsUri);
	intent.putExtra("sms_body", "SMS Àü¼ÛÇÕ´Ï´Ù.");
	intent.setType("vnd.android-dir/mms-sms");


	// MMS Àü¼Û
	Uri mmsUri = Uri.parse("tel:010-1234-4567");
	intent = new Intent(Intent.ACTION_SEND, mmsUri);
	Uri mediaUri = Uri.parse("content://media/external/images/media/123");
	intent.putExtra("sms_body", "À̹ÌÁö¿Í ÇÔ²² MMS Àü¼ÛÇÕ´Ï´Ù.");
	intent.putExtra(Intent.EXTRA_STREAM, mediaUri);
	intent.setType("image/png");


	// google °Ë»ö
	Intent intent2 = new Intent();
	intent2.setAction(Intent.ACTION_WEB_SEARCH);
	intent.putExtra(SearchManager.QUERY, "ã´Â ¹®ÀÚ");
	startActivity(intent2);
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.