android - Go to another activity before inserting from gallery -
maybe asked before couldn't find in question.
anyway able insert image gallery. want before inserting image , want go activity , let user add descriptions insert image( instagram when inserting image, when uploading image takes activity insert details)
this code:
public void opengallery() { // intent gallery = new intent(intent.action_pick, // android.provider.mediastore.images.media.internal_content_uri); //startactivityforresult(gallery, pick_image); intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); intent.putextra("crop", "true"); intent.putextra("aspectx", 0); intent.putextra("aspecty", 0); intent.putextra("outputx", 200); intent.putextra("outputy", 150); intent.putextra("return-data", true); startactivityforresult( intent.createchooser(intent, "complete action using"),2); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { bundle extras2 = data.getextras(); dbhelper db = new dbhelper(this); if (extras2 != null) { bitmap yourimage = extras2.getparcelable("data"); // convert bitmap byte bytearrayoutputstream stream = new bytearrayoutputstream(); yourimage.compress(bitmap.compressformat.png, 100, stream); byte imageinbyte[] = stream.tobytearray(); log.e("output before conversion", imageinbyte.tostring()); // inserting contacts log.d("insert: ", "inserting .."); db.addcontact(new contact("android", imageinbyte)); intent = new intent(mainactivity.this, mainactivity.class); startactivity(i); finish(); } }
note : above code lets insert image.
use intent travel description page , on filling description when user clicks submits details, again using intent make them travel select image options.
Comments
Post a Comment