Pass data object to an Activity from another activity (Fragment -> its Activity-> new Activity)

I have created listFragment class called "EventFragment" and i need to pass data object on its click event to pass drawerActivity class (fragment class) and then i need to pass that object to another activity called EventDisplayActivity class. I could manage get data object to the drawerActivity class but i cant send that to the EventDisplayActivity class. //DrawerActivity code @Override public void OnEventItemClick(ZEvent zEventObject) { Log.i("URI uri", ""+zEventObject.getEventName()); zEventItem = (ZEvent)zEventObject; Bundle b = new Bundle(); b.putParcelable("EVENT_ITEM", zEventItem); Intent i = new Intent(DrawerActivity.this, EventDisplayActivity.class); i.putExtra("DUMMY","dummytext"); i.putExtras(b); startActivity(i); } // EventDisplayActivity @Override protected void onInit(ModelBase... data) { System.out.println("onInit() Called in Event Display Activity"); SharedPreferences sessionkey = getApplicationContext().getSharedPreferences("session_detail", Context.MODE_PRIVATE); session_token = sessionkey.getString("session", ""); logged_user_type = sessionkey.getString("user_type", ""); logged_user_id = sessionkey.getString("user_id", ""); Intent i = getIntent(); Bundle extras = i.getExtras(); ZEvent zEventbundle = extras.getParcelable("EVENT_ITEM"); mProposalId = zEventbundle.getProposalID(); String mDummy = getIntent().getStringExtra("DUMMY"); Log.i("id>>>",""+mProposalId +"Dummy"+mDummy); params = new RequestParams(); params.put("token", session_token); params.put("proposal_id", mProposalId); mApiClient.getView(eventViewURL, params, eventResponse); } //LOgCat java.lang.RuntimeException: Unable to start activity ComponentInfo{gg.zing/gg.zin.zing.events.activities.EventDisplayActivity}: java.lang.NullPointerException Caused by: java.lang.NullPointerException at gg.zin.zing.events.activities.EventDisplayActivity.onInit(EventDisplayActivity.java:431)

以上就是Pass data object to an Activity from another activity (Fragment -> its Activity-> new Activity)的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏