samedi 9 mai 2015

How to pass class object to activity

I have a BarcodeReaderActivity which I'll start in a couple of activities and before I start this activity, I want to pass a destination activity class for this BarcodeReaderActivity so after reading QR code, I want it to open destination activity with Intent.

My first solution is to pass destination class name as string and use switch case in BarcodeReaderActivity and write specific Intent for that class.

I also tried to create BarcodeReader as fragment first but then when I start the destination activity and then remove the fragment it shows the previous activity for a short amount of time but I don't want that to happen.

I would like to get some advice from you, if you know a better approach.

Aucun commentaire:

Enregistrer un commentaire