public class ImIntentAdvanced extends Activity
implements View.OnClickListener {
private Button b1, b2, b3, b4, b5, b6, b7, b8, b9, b10;
private Button b11, b12, b13, b14, b15, b16, b17, b18, b19, b20;
private Button b21, b22, b23, b24, b25;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
init();
}
private void init(){
b1 = (Button)findViewById(R.id.Button01);
b2 = (Button)findViewById(R.id.Button02);
b3 = (Button)findViewById(R.id.Button03);
b4 = (Button)findViewById(R.id.Button04);
b5 = (Button)findViewById(R.id.Button05);
b6 = (Button)findViewById(R.id.Button06);
b7 = (Button)findViewById(R.id.Button07);
b8 = (Button)findViewById(R.id.Button08);
b9 = (Button)findViewById(R.id.Button09);
b10 = (Button)findViewById(R.id.Button10);
b11 = (Button)findViewById(R.id.Button11);
b12 = (Button)findViewById(R.id.Button12);
b13 = (Button)findViewById(R.id.Button13);
b14 = (Button)findViewById(R.id.Button14);
b15 = (Button)findViewById(R.id.Button15);
b16 = (Button)findViewById(R.id.Button16);
b17 = (Button)findViewById(R.id.Button17);
b18 = (Button)findViewById(R.id.Button18);
b19 = (Button)findViewById(R.id.Button19);
b20 = (Button)findViewById(R.id.Button20);
b21 = (Button)findViewById(R.id.Button21);
b22 = (Button)findViewById(R.id.Button22);
b23 = (Button)findViewById(R.id.Button23);
b24 = (Button)findViewById(R.id.Button24);
b25 = (Button)findViewById(R.id.Button25);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
b3.setOnClickListener(this);
b4.setOnClickListener(this);
b5.setOnClickListener(this);
b6.setOnClickListener(this);
b7.setOnClickListener(this);
b8.setOnClickListener(this);
b9.setOnClickListener(this);
b10.setOnClickListener(this);
b11.setOnClickListener(this);
b12.setOnClickListener(this);
b13.setOnClickListener(this);
b14.setOnClickListener(this);
b15.setOnClickListener(this);
b16.setOnClickListener(this);
b17.setOnClickListener(this);
b18.setOnClickListener(this);
b19.setOnClickListener(this);
b20.setOnClickListener(this);
b21.setOnClickListener(this);
b22.setOnClickListener(this);
b23.setOnClickListener(this);
b24.setOnClickListener(this);
b25.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.Button01: m1(); break;
case R.id.Button02: m2(); break;
case R.id.Button03: m3(); break;
case R.id.Button04: m4(); break;
case R.id.Button05: m5(); break;
case R.id.Button06: m6(); break;
case R.id.Button07: m7(); break;
case R.id.Button08: m8(); break;
case R.id.Button09: m9(); break;
case R.id.Button10: m10(); break;
case R.id.Button11: m11(); break;
case R.id.Button12: m12(); break;
case R.id.Button13: m13(); break;
case R.id.Button14: m14(); break;
case R.id.Button15: m15(); break;
case R.id.Button16: m16(); break;
case R.id.Button17: m17(); break;
case R.id.Button18: m18(); break;
case R.id.Button19: m19(); break;
case R.id.Button20: m20(); break;
case R.id.Button21: m21(); break;
case R.id.Button22: m22(); break;
case R.id.Button23: m23(); break;
case R.id.Button24: m24(); break;
case R.id.Button25: m25(); break;
}
}
private void m1(){ //연락처 등록
Intent intent = new Intent(
Intent.ACTION_INSERT, Uri.parse("content://contacts/people"));
startActivity(intent);
}
private void m2(){ //다이얼 화면
/*Intent intent = new Intent(
Intent.ACTION_DIAL, Uri.parse("tel:01024757431"));*/
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:01024757431"));
startActivity(intent);
}
private void m3(){ //전화 바로 걸기
Intent intent = new Intent(
Intent.ACTION_CALL, Uri.parse("tel:01024757431"));
startActivity(intent);
}
private void m4(){ //SMS발송
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", "요거시 보내지는 내용이여~!");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
}
private void m5(){ //이메일 발송
Intent intent = new Intent(
Intent.ACTION_SENDTO,
Uri.parse("mailto:khs1128@gmail.com"));
startActivity(intent);
}
private void m6(){ //Browser에서 URL 호출하기
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.hanmail.net/"));
startActivity(intent);
}
private void m7(){ //브라우저에서 검색
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, "검색어");
startActivity(intent);
}
private void m8(){ //지도 보기
Uri uri = Uri.parse ("geo: 37.00, 128.00");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
private void m9(){ //마켓에서 특정앱 검색
Uri uri = Uri.parse("market://search?q=pname:soo.location.sos");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
private void m10(){ //마켓에서 상세 페이지
Uri uri = Uri.parse("market://details?id=soo.location.sos");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
private void m11(){ //다른 앱(패키지)의 특정 액티비티 호출
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"soo.intent.test", "soo.intent.test.IntentT1"));
startActivity(intent);
}
private void m12(){ //일정표 바로 가기
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.android.calendar",
"com.android.calendar.LaunchActivity"));
startActivity(intent);
}
private void m13(){ //이메일 설정 액티비티 바로 가기
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.android.email",
"com.android.email.activity.Welcome"));
startActivity(intent);
}
private void m14(){ //브라우져 액티비티 띄우기
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.android.browser",
"com.android.browser.BrowserActivity"));
startActivity(intent);
}
private void m15(){ //음성 검색 액티비티 호출
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.google.android.voicesearch",
"com.google.android.voicesearch.RecognitionActivity"));
startActivity(intent);
}
/*
private void m16(){ //카메라앱 호출 - 안됨
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.sec.android.app.camera",
"com.sec.android.app.camera.Camera"));
startActivity(intent);
}
private void m16(){ //DMB앱 호출 - 안됨
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.sec.android.app.dmb",
"com.sec.android.app.dmb.activity.DMBFullScreenView"));
startActivity(intent);
}*/
private void m16(){ //환경설정앱 호출
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.android.settings",
"com.android.settings.Settings"));
startActivity(intent);
}
/*
private void m17(){ //작업관리자앱 호출 - 안됨
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.sec.android.app.controlpanel",
"com.sec.android.app.controlpanel.activity.JobManagerActivity"));
startActivity(intent);
}*/
private void m17(){ //마켓 메인액티비티로 이동
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(
"com.android.vending",
"com.android.vending.AssetBrowserActivity"));
startActivity(intent);
}
private void m18(){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(
new File(
"/sdcard/dcim/camera/2011-04-24_19-23-03_803.jpg")),
"image/jpg");
startActivity(intent);
}
private void m19(){
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/*");
//intent.setType("video/*");
startActivity(intent);
}
private void m20(){
}
private void m21(){
}
private void m22(){
}
private void m23(){
}
private void m24(){
}
private void m25(){
}
}