1
votes

I have an application with 4 tabs, each one has an ActivityGroup.

In one tab, at certain child activity I launch the gallery to pick up a photo:

Intent i = new Intent(Intent.ACTION_PICK); i.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.Media.CONTENT_TYPE); getParent().startActivityForResult(i,Documento.SELECCIONAR_FOTO_FROM_GALLERY);

This was working fine till jelly bean, in this version when I start an activity using startActivityForResult the application restart automatically when the onActivityResult has to be called.

I know that ActiviyGroup is deprecated since a long time ago and I should move to Fragments but, is there any way to make this work in jelly bean without migrating to Fragments?

I'm trying to fix it opening the gallery as a childActivity of the ActivityGroup:

        Intent i = new Intent(Intent.ACTION_PICK) ;
        i.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.Media.CONTENT_TYPE) ;
        TabGroupActivity parentActivity = (TabGroupActivity)MyActivity.this.getParent();
        parentActivity.startChildActivity("MyGalleryActivity", i);  
        dialog.cancel();

But i get the next exception:

10-19 16:10:48.403: E/AndroidRuntime(9237): java.lang.SecurityException: Requesting code from com.sec.android.gallery3d (with uid 10112) to be run in process jaime.mapas (with uid 10165)

Any ideas?

EDIT:

Finally I moved to Fragments, very much easier than I thought.

1
What do you mean by "application restart", let alone "application restart automatically"?CommonsWare
The application restarts, it is killed and started again (the launcher activity is shown). And LogCat say nothing about it.jimbo82

1 Answers

0
votes

This was working fine till jelly bean, in this version when I start an activity using startActivityForResult the application restart automatically when the onActivityResult has to be called.

This is expected behavior. There is no guarantee that your app's process will remain in memory when it is not in the foreground. This is no different than if the user pressed HOME, then returned to your app some time later via the recent-tasks list.

is there any way to make this work in jelly bean without migrating to Fragments?

Fragments will not help, as it already works as expected.