티스토리 뷰

개발/개발 자료

안드로이드 Intent 예제

시원한물냉 2013. 9. 8. 17:24

[Android] Intent 활용 예제

안드로이드 Intent 활용 예제


  • 연락처 Intent
  1. //   연락처 조회  
  2. Intent intent = new Intent(Intent.ACTION_VIEW,  
  3.          Uri.parse("content://contacts/people" + String.valueOf(contact.getId())));  
  4. startActivity(intent);  
  1. //   연락처 등록  
  2. Intent intent = new Intent(Intent.ACTION_INSERT,  
  3.          Uri.parse("content://contacts/people"));  
  4. startActivity(intent);  
  1. //   연락처 수정  
  2. Intent intent = new Intent(Intent.ACTION_EDIT,  
  3.          Uri.parse("content://contacts/people" + String.valueOf(contact.getId())));  
  4. startActivity(intent);  
  1. //   연락처 삭제  
  2. Intent intent = new Intent(Intent.ACTION_DELETE,  
  3.          Uri.parse("content://contacts/people" + String.valueOf(contact.getId())));  
  4. startActivity(intent);  

  • 전화 Intent
  1. //   전화걸기 화면  
  2. Intent intent = new Intent(Intent.ACTION_DIAL,  
  3.          Uri.parse("tel:" + TelNumber));  
  4. startActivity(intent);  
  1. //   전화걸기  
  2. Intent intent = new Intent(Intent.ACTION_CALL,  
  3.          Uri.parse("tel:" + TelNumber));  
  4. startActivity(intent);  

  • SMS Intent
  1. //   SMS 발송 화면  
  2. Intent intent = new Intent(Intent.ACTION_VIEW)  
  3. intent.putExtra("sms_body""The SMS text");  
  4. intent.setType("vnd.android-dir/mms-sms");  
  5. startActivity(intent);  
  1. //   SMS 보내기  
  2. Intent intent = new Intent(Intent.ACTION_SENDTO,  
  3.          Uri.parse("sms_body:" + "The SMS text"));  
  4. intent.setType("vnd.android-dir/mms-sms");  
  5. startActivity(intent);  

  • 이메일 Intent
  1. //   이메일 발송 화면  
  2. Intent intent = new Intent(Intent.ACTION_SENDTO,  
  3.          Uri.parse("mailto:" + "The 이메일 text"));  
  4. startActivity(intent);  

  • 브라우저 Intent
  1. //   브라우저에서 URL 호출하기  
  2. Intent intent = new Intent(Intent.ACTION_VIEW,  
  3.          Uri.parse("http://www.google.com/"));  
  4. startActivity(intent);  
  1. //   브라우저에서 검색  
  2. Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);  
  3. intent.putExtra(SearchManager.QUERY, "검색어");  
  4. startActivity(intent);  

  • 지도 Intent
  1. //  지도 화면  
  2. Intent intent = new Intent(Intent.ACTION_SENDTO,  
  3.          Uri.parse("geo: 38.00, -35.03"));  
  4. startActivity(intent);  

  • 안드로이드 마켓 Intent
  1. //   안드로이드 마켓에서 App 검색  
  2. Intent intent = new Intent(Intent.ACTION_VIEW,  
  3.          Uri.parse("market://search?q=pname:전체패키지명"));  
  4. startActivity(intent);  
  1. //   안드로이드 마켓에서 App 상세 화면  
  2. Intent intent = new Intent(Intent.ACTION_WEB_SEARCH,  
  3.          Uri.parse("market://details?id=전체패키지명"));  
  4. startActivity(intent);  

  • App 삭제 Intent
  1. //   안드로이드 마켓에서 App 삭제  
  2. Intent intent = new Intent(Intent.ACTION_DELETE);  
  3. intent.setData(Uri.parse("전체패키지명"));  
  4. startActivity(intent);  


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함