Ask Your Question

How to pass Mat array between two android activities

asked 2012-12-08 13:41:44 -0500

Qichao Chen gravatar image

I have a problem with passing Mat array between two android activities,anyone can help me?

I have solved these problem by writing Mat array to SD-Card as images and read images from SD-Card in another activity.but it has a problem with speed when running on the android phone.


edit retag flag offensive close merge delete


How do you solve a problem?

rrobsonm gravatar imagerrobsonm ( 2014-05-05 09:20:19 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-01-12 13:22:08 -0500

updated 2015-01-12 13:23:03 -0500

You can declare the Mat static and access it directly from the other activity or you can send the Mat using intents and serializable/parcelable. Parcelable is much faster; here's an example:

If you want, you can even use an external library like Greenrobot's Eventbus that can you can use to post the Mat on the event bus and access that object from the event bus from ANY activity, service, fragment, etc. Here's more info about EventBus:

edit flag offensive delete link more

Question Tools


Asked: 2012-12-08 13:41:44 -0500

Seen: 1,064 times

Last updated: Jan 12 '15