Ask Your Question
0

How to pass Mat array between two android activities

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

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.

thanks.

edit retag flag offensive close merge delete

Comments

How do you solve a problem?

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

1 answer

Sort by ยป oldest newest most voted
0

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

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

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: http://stackoverflow.com/questions/29...

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: https://github.com/greenrobot/EventBus

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 1,314 times

Last updated: Jan 12 '15