从A程序跳转至B程序
首先在目标APP的清单配置文件manifest中的主Activity中添加:
android:exported="true"其次在A程序的跳转监听中添加如下代码:
ComponentName c =new ComponentName("com.*******.*******", //目标应用包名 "com.*******.*******.TargetActivity"); //目标应用Activity包名.类名 TargetActivity manifest中需要配置: //<intent-filter> //<action android:name="android.intent.action.MAIN"/> try { intent = new Intent(); intent.setComponent(c); startActivity(intent); } catch (Exception e) { Log.i("tag", e.toString()); Toast.makeText(getApplicationContext(), "未找到可用应用程序!", Toast.LENGTH_LONG).show(); }