怎样打开另一个app并传递一些参数过去?
app1
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.example.xeednfc");
Bundle bundle = new Bundle();
     bundle.putString("user","1");
     LaunchIntent.putExtras(bundle);
startActivity(LaunchIntent);app2protected void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);
Bundle bunde = getIntent().getExtras();
怎么bundle 一直是空的。接收不到
if(bunde!=null)
{
  bundle.getString("user");}
}

解决方案 »

  1.   

    ContentProvider 你可以网上搜一下  这是Android的四大组件之一
      

  2.   

    你这个方法是启动的主activity就是配置main的,这个你控制不了。其他activity就自己在配置文件写个action,然后用这个action打开。打开的不是主界面了
      

  3.   

    为什么不用Intent i=new Intent(A.this,B.class)来传递参数呢?
      

  4.   

    还是给你写代码
    在第一个app里Intent intent = new Intent("com.ox.lyq.ABCD");
    intent.putExtra("abcd", "ABCD");
    startActivity(Intent.createChooser(intent, "ABCD"));
    在第二个app的AndroidManifest.xml里
     <activity android:name="BActivity" >
                <intent-filter>
                    <action android:name="com.ox.lyq.ABCD" />                <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
     </activity>
     <category android:name="android.intent.category.DEFAULT" />
    不可少
    在这个activity里textView = (TextView) findViewById(R.id.textView1);
    Intent intent = getIntent();
    if (intent != null) {
        String str = intent.getStringExtra("abcd");
        textView.setText(str);
    }
    这绝对是2个app
      

  5.   

    contentprivider 看起来很复杂啊。。
      

  6.   

    contentprivider  看的我快吐血了。就传一个参数,用的着搞的这么复杂吗