android - How can i set my selected image from gallery to my application in imageview via share option. -


i building application in can share photo gallery application, same concept of 'pinterest'. undergoes through login gateway , if user login set selected image imageview or either login continue same. share option directly share menu of phone gallery see in listview when click on share option in gallery i.e.,mail, bluetooth etc.

i want know,how can set selected image imageview of application after login via share option gallery.

i got answer :) can done using intent :

intent intent = getintent(); // action of intent string action = intent.getaction(); // type of intent (text or image) string type = intent.gettype(); // when intent's action 'action+send' , tyoe not null if (intent.action_send.equals(action) && type != null) {      if (type.startswith("image/")) { // when type 'image/*'            handlesendimage(intent); // handle single image being sent        } } private void handlesendimage(intent intent) {     // image uri intent     uri imageuri = (uri) intent.getparcelableextra(intent.extra_stream);     // when image uri not null     if (imageuri != null) {         // update ui reflect image being shared         view_news.setimageuri(imageuri);         news.setvisibility(view.gone);     } else{         toast.maketext(this, "error occured, uri invalid", toast.length_long).show();     } } 

this solved problem of getting image gallery , displaying in imageview in 'pinterest' application. :)


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -