2016-05-04 1 views
-3

別の使用バンドルに1つの活動からのデータを渡すことができないです:私はこれはエラーのログです

I /アート:背景スティッキー並行マークスイープGCは、9226(1168キロバイト) AllocSpaceオブジェクトを解放し、 4(84キロバイト)LOSオブジェクト、0%無料、47メガバイト/ 47メガバイト、 1.006msを一時停止し、全123.548ms

W /アート:すべてのスレッドを一時停止がかかった:5.356ms

W/ArrayMapを:新しいハッシュ0前であります配列ハッシュの終わり6295518インデックス4 キー java.lang.RuntimeException:ここ android.util.ArrayMap.append(ArrayMap.java:494) でandroid.os.Parcel.readArrayMapInternal(Parcel.java:2483) でandroid.osで。 eorder.nm.com.mealplanz.activity.LoginActivity.getDataFromOtherActivity(LoginActivity.java:180)でandroid.os.BaseBundle.getString(BaseBundle.java:918) でBaseBundle.unparcel(BaseBundle.java:221) at eorder.nm.com.mealplanz.activity.LoginActivity.initialize(LoginActivity.java:93) at eorder.nm.com.mealpl でanz.activity.BaseActivityNew.onCreate android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)で(BaseActivityNew.java:70)android.app.Activity.performCreate(Activity.java:5953)で android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267) で android.app.ActivityThread.access $ 800からandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388) (ActivityThread.java:148) で android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1292) android.os.Handler.dispatc hMessage(Handler.java:102) とandroid.os.Looper.loop(Looper.java:135) とandroid.app.ActivityThread.main(ActivityThread.java:5312) at java.lang.reflect.Methodにあります。 COMで com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:901) でjava.lang.reflect.Method.invokeで(ネイティブメソッド) (Method.java:372) を呼び出します。 android.internal.os.ZygoteInit.main(ZygoteInit。Javaの:696)

これは私がBundleを埋めるコードです:

private void gotoLoginActivity() { 

    Intent loginIntent = new Intent(context, LoginActivity.class); 

    Bundle bundle = new Bundle(); 

    bundle.putString(AppConstant.CLASSFROM, AppConstant.LOGINACTIVITY); 
    bundle.putParcelableArrayList(AppConstant.CARTLIST, orderCartDomains); 
    bundle.putDouble(AppConstant.TOTALPRICE, totalprice); 
    bundle.putDouble(AppConstant.TAXPRICE, tax); 
    bundle.putDouble(AppConstant.SUBGRANDTOTAL, subtotal); 


    loginIntent.putExtras(bundle); 

    startActivity(loginIntent); 
    finish(); 
} 

私はBundleからデータを取得しようとする場所です:

private void getDataFromOtherActivity() { 

    Bundle bundle = getIntent().getExtras(); 

    classFrom = bundle.getString(AppConstant.CLASSFROM); 

    if (classFrom.equalsIgnoreCase(AppConstant.ITEMACTIVITY)) { 
     orderCartDomains = bundle.getParcelableArrayList(AppConstant.CARTLIST); 
     totalrice = bundle.getDouble(AppConstant.TOTALPRICE); 
     subgrandtotal = bundle.getDouble(AppConstant.SUBGRANDTOTAL); 
     taxprice = bundle.getDouble(AppConstant.TAXPRICE); 

    } else if (classFrom.equalsIgnoreCase(AppConstant.LOGINACTIVITY)) { 
     orderCartDomains = bundle.getParcelableArrayList(AppConstant.CARTLIST); 
     totalrice = bundle.getDouble(AppConstant.TOTALPRICE); 
     subgrandtotal = bundle.getDouble(AppConstant.SUBGRANDTOTAL); 
     taxprice = bundle.getDouble(AppConstant.TAXPRICE); 

    } 
} 
+0

...ナビゲーションのための意図を使用してみてください、私は –

+0

同じ例外に1つの活動からのデータを渡す「bundle.putParcelableArrayList(AppConstant.CARTLIST、orderCartDomains);」 –

+0

は、この行を削除してみてください取得しています別の –

答えて

0

希望このコードは役に立ちます

Bundle bundle = new Bundle(); 

bundle.putString("name", "Android"); 
bundle.putString("iname", "iPhone"); 
Intent intent = new Intent(this, ActivityB.class); 
intent.putExtras(bundle); 
startActivity(intent); 

// In ActivityB.class 
public Bundle getBundle = null; 
getBundle = this.getIntent().getExtras(); 

String name = getBundle.getString("name"); 
String id = getBundle.getString("iname"); 
関連する問題