(Demo1) Add the logic of "Start Activity" with the package name and alias

This commit is contained in:
zhangjiongxuan 2017-07-20 17:24:18 +08:00
parent 70143f4647
commit f91191a82c

View File

@ -37,13 +37,15 @@ public class MainActivity extends Activity {
findViewById(R.id.btn_start_demo1).setOnClickListener(new View.OnClickListener() { findViewById(R.id.btn_start_demo1).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
RePlugin.startActivity(MainActivity.this, RePlugin.createIntent("demo1", "com.qihoo360.replugin.sample.demo1.MainActivity")); // 刻意以包名来打开
RePlugin.startActivity(MainActivity.this, RePlugin.createIntent("com.qihoo360.replugin.sample.demo1", "com.qihoo360.replugin.sample.demo1.MainActivity"));
} }
}); });
findViewById(R.id.btn_start_plugin_for_result).setOnClickListener(new View.OnClickListener() { findViewById(R.id.btn_start_plugin_for_result).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// 刻意以Alias别名来打开
Intent intent = new Intent(); Intent intent = new Intent();
intent.setComponent(new ComponentName("demo1", "com.qihoo360.replugin.sample.demo1.activity.for_result.ForResultActivity")); intent.setComponent(new ComponentName("demo1", "com.qihoo360.replugin.sample.demo1.activity.for_result.ForResultActivity"));
RePlugin.startActivityForResult(MainActivity.this, intent, REQUEST_CODE_DEMO1, null); RePlugin.startActivityForResult(MainActivity.this, intent, REQUEST_CODE_DEMO1, null);