android|android 程序间跳转

demo:
【android|android 程序间跳转】

package com.android.tutor; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class StartAnotherApplicationDemo extends Activity { private Button mButton01, mButton02; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mButton01 = (Button) findViewById(R.id.button); mButton02 = (Button) findViewById(R.id.start_calender); // -----启动我们自身写的程序------------------ mButton01.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // -----核心部分----- 前名一个参数是应用程序的包名,后一个是这个应用程序的主Activity名 Intent intent = new Intent(); intent.setComponent(new ComponentName( "com.droidnova.android.games.vortex", "com.droidnova.android.games.vortex..Vortex")); startActivity(intent); } }); // -----启动系统自带的应用程序------------------ mButton02.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity")); startActivity(intent); } }); } }



    推荐阅读