android - Passing View with Intent -


i want passing viewto update view in other activity. code passing view.

emp_photo_edit.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 intent = new intent(intent.action_pick,android.provider.mediastore.images.media.external_content_uri);                 i.putextra("container", (serializable) viewdialog);                 ((employeeactivity)context).startactivityforresult(i, 2017);             }         }); 

then want update view in other activity

@override protected void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);     if (requestcode == 2017 && resultcode == result_ok && null != data) {         uri selectedimage = data.getdata();         string[] filepathcolumn = { mediastore.images.media.data };         cursor cursor = getcontentresolver().query(selectedimage,filepathcolumn, null, null, null);         cursor.movetofirst();         int columnindex = cursor.getcolumnindex(filepathcolumn[0]);         string picturepath = cursor.getstring(columnindex);         cursor.close();         view apa = (view) data.getserializableextra("content");         //view dialog = view.inflate(getapplicationcontext(),r.layout.dialog_employee_edit,null);         imageview imageview = (imageview) apa.findviewbyid(r.id.emp_photo_edit);         imageview.setimagebitmap(bitmapfactory.decodefile(picturepath));     } } 

but show exception.

  fatal exception: main    java.lang.classcastexception: android.widget.linearlayout cannot cast java.io.serializable     @ com.fingerspot.hz07.revocloud.adapter.employeeadapter$myviewholder$5.onclick(employeeadapter.java:334)     @ android.view.view.performclick(view.java:4084)     @ android.view.view$performclick.run(view.java:16966)     @ android.os.handler.handlecallback(handler.java:615)     @ android.os.handler.dispatchmessage(handler.java:92)     @ android.os.looper.loop(looper.java:137)     @ android.app.activitythread.main(activitythread.java:4745)     @ java.lang.reflect.method.invokenative(native method)     @ java.lang.reflect.method.invoke(method.java:511)     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786)     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553)     @ dalvik.system.nativestart.main(native method) 

arguments passed bundle should implement serializable or parcelable interface. linearlayout doesn't. best solution pass data inside view intent , apply view in receiving activity


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -