我是 android 新手。如何在 ListView 行中显示带有文本的视频缩略图?
我在我的数据库(服务器)中存储了一组 youtube url。通过使用 AsyncTask,我检索了 url 并存储在一个数组字符串中......现在在 onPostExecute 方法中......如何在列表视图中显示这个数组视频 url 和文本?
这个怎么实现??
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...
}
}