سؤال

Im new to android.. How to show video thumbnail with text in a ListView row?

I have stored a set of youtube url in my database(server). By using AsyncTask i retrieved the url's and stored in an array string... Now in onPostExecute method..How to display this array video url's in list view with text??

How to implement this??

class LoadFiles extends AsyncTask<String, String, String> {
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(Focusarea.this);
        pDialog.setMessage("Loading Videos. Please wait...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);
        pDialog.show();
    }
      protected String doInBackground(String... args) {
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("name", name));
        json = jsonParser.makeHttpRequest(url_geturl, "GET", params);           
    Log.d("All Groups: ", json.toString());
    try {
        int success = json.getInt(TAG_SUCCESS);
        System.out.println("Success");
        if (success == 1) {
            System.out.println("Success");   
            groups = json.getJSONArray(TAG_GROUP);
            System.out.println("Result Success+++"+groups);
            for (int i = 0; i < groups.length(); i++) {
            JSONObject c = groups.getJSONObject(i);
                String intro = c.getString(TAG_INTRO);
                System.out.println("Checking ::"+intro);
                                vid.add(intro);
                System.out.println("VIDEOS LINK" + vid);
                if(intro!=null && intro!=""){
                    videoUrl=intro;
                }else {
                    showAlert();
                }
                            } catch (JSONException e) {
        System.out.println("Error "+e.toString());
            }
        return null;
          }
               protected void onPostExecute(String file_url) {
        // dismiss the dialog after getting VIDEOS
        pDialog.dismiss();  
        vid=new ArrayList<String>(new ArrayList<String>(vid));
           // how to implement here...
                }
             }
هل كانت مفيدة؟

المحلول

1) AsyncTasks in which the image is downloaded first, stored into a cache, and then displayed on the onPostExecute method. The image is obtained from the cache subsequently.

2) Nostra's Universal Image Loader.

3) Fedor's LazyList. And;

4) Novoda's ImageLoader.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top