Im trying to figure out how to access an image from the android default gallery and email it -



Im trying to figure out how to access an image from the android default gallery and email it -

i've figured out how access default gallery, , i've figured out how utilize email function text wanna email images in gallery, how do this? going seek , utilize code bellow error keeps poping "gettempuri", overlooking, appreciate help on this. thanks

public void onclick(view v) { intent photosendbutton = new intent(intent.action_send); photosendbutton.setflags(intent.flag_activity_new_task); photosendbutton.putextra(intent.extra_email, new string[]{"johnnywalker@hotmail.com"}); photosendbutton.settype("image/*"); uri parse = gettempuri("/mnt/sdcard/yourfolder"); photosendbutton.putextra(mediastore.extra_output, parse); startactivity(intent.createchooser(photosendbutton, "send mail..."));

this because you're trying access method within onclicklistener. method gettempuri defined outside onclicklistener, don't see because onclicklistener declared inline this:

class yourcontainingclass{ public uri gettempuri(string){ //process string } public void someothermethod(){ button.setonclicklistener(new onclicklistener(){ public void onclick(view v) { //this you're trying access gettempuri, //from within new onclicklistener instance } }); } }

you can solve accessing gettempuri this, if containing class activity:

((yourcontainingclass)v.getcontext()).gettempuri()

otherwise can allow containing class implement onclicklistener this:

class yourcontainingclass implements onclicklistener { public void somemethod(){ button.setonclicklistener(this); } public void onclick(view v){ //put code here, here have access gettepuri this.gettempuri(); } public uri gettempuri(string somestring){ //your logic } }

i realize may hard follow, seek out , sense free inquire questions

android image email photo send

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -