java - Allow user to choose an image from their gallery to upload to imageview in an activity? -


i not sure search for, have tried few things have not found need. have default image app logo displaying in imageview. have , "admin" activity user able customize app further. how allow them change default logo 1 of choice , display in same imageview on mainactivity (separate choose it, admin activity)??

thanks much!

on click of button trigger following code:

   @override             public void onclick(view v) {                 intent photopickerintent = new intent(intent.action_pick);                 photopickerintent.settype("image/*");                 startactivityforresult(photopickerintent, 1);             } 

on activityresult :

    @override     protected void onactivityresult(int requestcode, int resultcode, intent data) {     // todo auto-generated method stub     super.onactivityresult(requestcode, resultcode, data);     try {         string path = "";         if (requestcode == 1) {              if (resultcode == result_ok) {                 uri imageuri = data.getdata();                 log.d("image selected path", imageuri.getpath());                 system.out.println("image selected path"                         + imageuri.getpath());                  path = getrealpathfromuri(editprofilememberactivity.this,                         imageuri);              }    //do other stuff          }     } catch (exception e) {         system.out.println(e);     }  } 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -