3 回答

TA貢獻(xiàn)1780條經(jīng)驗 獲得超1個贊
CustomListing currentListing = new CustomListing();Intent i = new Intent(); Bundle b = new Bundle();b.putParcelable(Constants.CUSTOM_LISTING, currentListing); i.putExtras(b);i.setClass(this, SearchDetailsActivity.class);startActivity(i);
Bundle b = this.getIntent().getExtras();if (b != null) mCurrentListing = b.getParcelable(Constants.CUSTOM_LISTING);

TA貢獻(xiàn)1772條經(jīng)驗 獲得超5個贊
getApplication()
.

TA貢獻(xiàn)1804條經(jīng)驗 獲得超7個贊
class Myclass { int a; class SubClass { int b; }}
MyClass src = new MyClass();Gson gS = new Gson();String target = gS.toJson(src); // Converts the object to a JSON String
Intent i = new Intent(FromActivity.this, ToActivity.class);i.putExtra("MyObjectAsString", target);
String target = getIntent().getStringExtra("MyObjectAsString");MyClass src = gS.fromJson(target, MyClass.class); // Converts the JSON String to an Object
更新
- 3 回答
- 0 關(guān)注
- 314 瀏覽
添加回答
舉報