Note that there are some explanatory texts on larger screens.

plurals
  1. POSecond activity is not being displayed using Activitygroup with Tab
    primarykey
    data
    text
    <p>In my app, I' using Tab. There are three tabs. In which 3rd tab is Activity group which has two activities. In first activity, there are two options for user. User can choose image from camera or from gallery. After selecting an image, user should move to child activity, which will display selected image in that activity. Below is my code...</p> <pre><code>public class GalleryPic extends Activity { private static final int TAKE_PICTURE = 0; private static final int REQUEST_ID = 1; private static final int HALF = 2; private Uri mUri; private Bitmap mPhoto; ImageView ivGallery, ivCamera; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery_pic); ivGallery = (ImageView)findViewById(R.id.gallery); ivCamera = (ImageView)findViewById(R.id.snap); ivGallery.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/*"); Intent in = new Intent(getParent(), GalleryPic_Second.class); TabGroupActivity parent = (TabGroupActivity) getParent(); parent.startChildActivity("ArrowsActivity", in); startActivityForResult(intent, REQUEST_ID); } }); ivCamera.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent("android.media.action.IMAGE_CAPTURE"); File f = new File(Environment.getExternalStorageDirectory(), "photo.jpg"); i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f)); mUri = Uri.fromFile(f); Intent in = new Intent(getParent(), GalleryPic_Second.class); TabGroupActivity parent = (TabGroupActivity) getParent(); parent.startChildActivity("ArrowsActivity", in); startActivityForResult(i, TAKE_PICTURE); } }); } public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case TAKE_PICTURE: if (resultCode == Activity.RESULT_OK) { getContentResolver().notifyChange(mUri, null); ContentResolver cr = getContentResolver(); Intent previewMessage = new Intent(getParent(), GalleryPic_Second.class); TabGroupActivity parentActivity = (TabGroupActivity) getParent(); parentActivity.startChildActivity("ArrowsActivity", previewMessage); try { mPhoto = android.provider.MediaStore.Images.Media.getBitmap(cr, mUri); Intent in = new Intent(getParent(), GalleryPic_Second.class); GalleryPic_Second.bmp = mPhoto; TabGroupActivity parent = (TabGroupActivity) getParent(); parentActivity.startChildActivity("ArrowsActivity", in); } catch (Exception e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); } } break; case REQUEST_ID : InputStream stream = null; if (resultCode == Activity.RESULT_OK) { try { stream = getContentResolver().openInputStream(data.getData()); Bitmap original = BitmapFactory.decodeStream(stream); Intent in = new Intent(getParent(), GalleryPic_Second.class); GalleryPic_Second.bmp = Bitmap.createScaledBitmap(original, original.getWidth()/HALF, original.getHeight()/HALF, true); TabGroupActivity parent = (TabGroupActivity) getParent(); parent.startChildActivity("ArrowsActivity", in); } catch (Exception e) { e.printStackTrace(); } if (stream != null) { try { stream.close(); } catch (Exception e) { e.printStackTrace(); } } } } } @Override public void onBackPressed() { // this.getParent().onBackPressed(); TabViewLayout parentTab = (TabViewLayout) this.getParent(); parentTab.switchTabBar(1); } } </code></pre> <p>What I'm facing here is, I'm not getting selected image in child activity group. I've searched about it and came to this solution... <a href="https://stackoverflow.com/questions/10777154/onactivityresult-is-not-working-in-tabactivitygroup">OnActivityResult is not working in TabActivityGroup?</a> But I'm not getting the explanation which is given in this link. What needs to be done?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload