Bootstrap

应用间简单数据传递

App A

@OnClick(R.id.login_setting) void jumpSetting(){
    Intent i = new Intent("com.cetnav.login", Uri.parse("login://login"));
    i.putExtra("username", "123456789");
    i.putExtra("password", "123456789");
    startActivity(i);

}
App B
Bundle bundle = getIntent().getExtras();
if(bundle!=null && bundle.containsKey("username")){
    String username = bundle.getString("username");
    String password = bundle.getString("password");
    Log.e("SplashActivity","username = "+username+" password = "+password);
    PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean(Key.AUTO_LOGIN, true).commit();
    PreferenceManager.getDefaultSharedPreferences(this).edit().putString("username",username).commit();
    PreferenceManager.getDefaultSharedPreferences(this).edit().putString("password", password).commit();
}
B manifest
<intent-filter>
    <action android:name="com.cetnav.login" />

    <data android:scheme="login" />

    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

all right done

;