package com.test;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class TestActivity extends Activity implements OnClickListener{
Button b1,b2,b3;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.comein);
findView();
bindView();
}
public void findView(){
b1 = (Button) findViewById(R.id.button3);
b2 = (Button) findViewById(R.id.button2);
b3 = (Button) findViewById(R.id.button1);
}
private void bindView() {
b1.setOnClickListener(this);
b2.setOnClickListener(this);
b3.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button2:
Intent i1 = new Intent(Intent.ACTION_MAIN);
i1.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn1 = new ComponentName("com.jy","com.jy.LogoActivity");
i1.setComponent(cn1);
Bundle bundle1 = new Bundle();
bundle1.putString("username", "test");
bundle1.putString("password", "test");
bundle1.putString("vehicelId", "402880861270516b0112740db2260115");
bundle1.putString("brand", "北京吉普");
bundle1.putString("vehicl", "切诺基BJ6420EA");
i1.putExtras(bundle1);
startActivity(i1);
break;
case R.id.button1:
Intent i2 = new Intent(Intent.ACTION_MAIN);
i2.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn2 = new ComponentName("com.jy","com.jy.LogoActivity"); //第一个参数是另外一个应用的包名,也是主配置文件Manifest里设置好的包名 第二个是类名,要带上包名
i2.setComponent(cn2);
Bundle bundle2 = new Bundle();
bundle2.putString("username", "test");
bundle2.putString("password", "test");
i2.putExtras(bundle2);
startActivity(i2);
break;
case R.id.button3:
Intent i3 = new Intent(Intent.ACTION_MAIN);
i3.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn3 = new ComponentName("com.jy","com.jy.LogoActivity");
i3.setComponent(cn3);
startActivity(i3);
break;
default:
break;
}
}
}