android - How can I set up an onclickListner to open a youtube video from an array list -


https://github.com/tony10toes/supporter2

i have array list of youtube videos.when user clicks on video want open in new window. getting error on url in arraylist [error message][1]

and how open in new window? have set onclick listener confused how use position show youtube video selected

 listview.setonitemclicklistener(new adapterview.onitemclicklistener() {                 @override                 public void onitemclick(adapterview<?> adapterview, view view, int position, long l) {                      // {@link video} object @ given position user clicked on                  video currentvideo = videos.get(position);                      currentvideo.equals(currentvideo.getvideoresourceurl());                     intent storiesintent = new intent(storiesactivity.this, videoactivity.class);                      startactivity(storiesintent); 

from video activity

        @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_video);              youtubeview = (youtubeplayerview) findviewbyid(r.id.youtube_view);             youtubeview.initialize(config.youtube_api_key, this);         }         @override         public void oninitializationsuccess(provider provider, youtubeplayer player, boolean wasrestored) {             if (!wasrestored) {                player.cuevideo("ju67yuuvnts"); // hard coded because cant figure out how url string in here             }         } 

from video adapter

public class videoadapter extends arrayadapter<video>  {      /** resource id background color list of videos */     private int mcolorresourceid;     public videoadapter(context context, arraylist<video> videos, int colorresourceid) {         super(context, 0, videos);         mcolorresourceid = colorresourceid;     }     @override     public view getview(int position, view convertview, viewgroup parent) {         // check if existing view being reused, otherwise inflate view         view listitemview = convertview;         if (listitemview == null) {             listitemview = layoutinflater.from(getcontext()).inflate(                     r.layout.list_item, parent, false);         }         // {@link video} object located @ position in list         video currentvideo = getitem(position);        // find textview in list_item.xml layout id default_text_view.         textview descriptiontextview = (textview) listitemview.findviewbyid(r.id.description_text_view);         // default translation currentword object , set text on         // default textview.         descriptiontextview.settext(currentvideo.getdescriptionvideoid());          // find imageview in list_item.xml layout id image.         imageview imageview = (imageview) listitemview.findviewbyid(r.id.image);         // check if image provided word or not         if (currentvideo.hasimage()) {             // if image available, display provided image based on resource id             imageview.setimageresource(currentvideo.getimageresourceid());             // make sure view visible             imageview.setvisibility(view.visible);         } else {             // otherwise hide imageview (set visibility gone)             imageview.setvisibility(view.gone);         }          // set theme color list item         view textcontainer = listitemview.findviewbyid(r.id.text_container);         // find color resource id maps         int color = contextcompat.getcolor(getcontext(), mcolorresourceid);         // set background color of text container view         textcontainer.setbackgroundcolor(color);          // return whole list item layout (containing 2 textviews) can shown in         // listview.         return listitemview;     }} 

very new stack overflow. in advance


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -