lao
lao

Reputation: 1680

How to override onCreate or onPause methods of a new Intent

I am creating a new intent like this:

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");

And I want to override its onCreate or onPause methods. How can I do it?

thanks.

Upvotes: 1

Views: 432

Answers (2)

jboi
jboi

Reputation: 11912

An Intent is compared to Intent filters as they're definded in the Apps Manifest's. If an Intent filter matches, the corresponding Activity or Service is started. So an Intent itself has no onCreate or onPause method.

The best you can do is, to create an Activity with the required behavior, put a SurfaceView with Camera logic in it and start it with your own intent.

Here is the link to Androids guide to camera apps. It's not too difficult to write the necessary Activity.

Upvotes: 2

Patrick
Patrick

Reputation: 35244

If you start a new intent you ask the system to call any activty that is registered for this action/namespaces. If you yourself register this in your app you can of course change the onCreate() or onPause(), but usually you have no possibility to change how the intent is handled by the other app. Furthermore I do not get your use-case, if you maybe make clear what you want to do SO could be more of assitence.

Upvotes: 0

Related Questions