<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="这是Test1" />
public class MainActivity extends ActionBarActivity { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // 跳转到另一个应用Test1的Activity Intent intent = new Intent(); //通过Android的name进行访问跳转,跳转到Test1的MainActivity intent.setClassName("com.test1", "com.test1.MainActivity"); startActivity(intent); } }); } }
<activity android:name="com.test1.MainActivity"></activity>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test1" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <permission android:name="permisson.test" android:protectionLevel="normal" android:label="权限示例"> </permission> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" android:permission="permission.test"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
<uses-permission android:name="permission.TEST"/>
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/zgljl2012/article/details/47388897