vr view android, how to get image from URL -


based on vr view sample code tutorial, how panorama image url or database ?

since sample tutorial load default image load assets manager , want know how load internet/url image link.

here first activity

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_detail_kuliner);      //initialize views     nama_kul = (textview) findviewbyid(r.id.namedetail_kul);     lokasi_kul = (textview) findviewbyid(r.id.lokasi_kul);     desclong_kul = (textview) findviewbyid(r.id.desclong_kul);     image_kul = (imageview) findviewbyid(r.id.imagedetail_kul);      //receive data     intent intent=this.getintent();     string name_kul=intent.getextras().getstring("name_key");     string lokas_kul=intent.getextras().getstring("lokasi_key");     final string descshor_kul=intent.getextras().getstring("descshort_key");     string desclon_kul=intent.getextras().getstring("desclong_key");     final string images_kul=intent.getextras().getstring("image_key");      //bind data     nama_kul.settext(name_kul);     lokasi_kul.settext(lokas_kul);     desclong_kul.settext(desclon_kul);     glide.with(this).load(images_kul).into(image_kul);      //intent 2nd activity     detail2buttonstart = (imagebutton) findviewbyid(r.id.detail2_but);     detail2buttonstart.setonclicklistener(new view.onclicklistener(){         @override         public void onclick(view v) {             intent intent = new intent(detail_kuliner.this, detail2_kuliner.class);             intent.putextra("descshort2_key",descshor_kul);             intent.putextra("image2_key",images_kul);              //open activity             startactivity(intent);         }     }); 

and second activity

public class detail2_kuliner extends appcompatactivity {  private static final string tag = detail2_kuliner.class.getsimplename(); private vrpanoramaview panowidgetview; public boolean loadimagesuccessful; private uri fileuri; private options panooptions = new options(); private imageloadertask backgroundimageloadertask;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_detail2_kuliner);     panowidgetview = (vrpanoramaview) findviewbyid(r.id.pano_view);     panowidgetview.seteventlistener(new activityeventlistener());     handleintent(getintent()); }  @override protected void onnewintent(intent intent) {     log.i(tag, this.hashcode() + ".onnewintent()");     setintent(intent);     handleintent(intent); }  private void handleintent(intent intent) {     if (intent.action_view.equals(intent.getaction())) {         log.i(tag, "action_view intent recieved");          fileuri = intent.getdata();         if (fileuri == null) {             log.w(tag, "no data uri specified. use \"-d /path/filename\".");         } else {             log.i(tag, "using file " + fileuri.tostring());         }          panooptions.inputtype = intent.getintextra("inputtype", options.type_mono);         log.i(tag, "options.inputtype = " + panooptions.inputtype);     } else {         log.i(tag, "intent not action_view. using default pano image.");         fileuri = null;         panooptions.inputtype = options.type_mono;     }      if (backgroundimageloadertask != null) {         backgroundimageloadertask.cancel(true);     }     backgroundimageloadertask = new imageloadertask();     backgroundimageloadertask.execute(pair.create(fileuri, panooptions)); }  @override protected void onpause() {     panowidgetview.pauserendering();     super.onpause(); }  @override protected void onresume() {     super.onresume();     panowidgetview.resumerendering(); }  @override protected void ondestroy() {     panowidgetview.shutdown();      if (backgroundimageloadertask != null) {         backgroundimageloadertask.cancel(true);     }     super.ondestroy(); }  class imageloadertask extends asynctask<pair<uri, options>, void, boolean> {      @override     protected boolean doinbackground(pair<uri, options>... fileinformation) {         options panooptions = null;           inputstream istr = null;         if (fileinformation == null || fileinformation.length < 1                 || fileinformation[0] == null || fileinformation[0].first == null) {             assetmanager assetmanager = getassets();              try {                 istr = new url("http://some url image").openstream(); //how url image intent sent @ first activity                  panooptions = new options();                 panooptions.inputtype = options.type_stereo_over_under;             } catch (ioexception e) {                 log.e(tag, "could not decode default bitmap: " + e);                 return false;             }         } else {             try {                 istr = new fileinputstream(new file(fileinformation[0].first.getpath()));                 panooptions = fileinformation[0].second;             } catch (ioexception e) {                 log.e(tag, "could not load file: " + e);                 return false;             }         }   panowidgetview.loadimagefrombitmap(bitmapfactory.decodestream(istr), panooptions);         try {             istr.close();         } catch (ioexception e) {             log.e(tag, "could not close input stream: " + e);         }         return true;     } } 

}

so want adding vr view second activity data came intent, data database sent json format, based on tutorial vr view android can put data intent first activity second activity (some url image)?

thank help

you can use picasso, glide or imageloader: example below:

 picasso.with(mcontext) .load("yoururl") .config(bitmap.config.rgb_565) .error(r.drawable.blank) .centerinside() .into(imageview); 

Comments