如何从它是从服务中来Android的视频网址缩略图?是从、中来、缩略图、网址

2023-09-07 08:50:49 作者:蹲下来抱抱自己

喜在我的应用我得到的图像的URL和视频网址的服务。从服务中得到这些之后,我在显示GridView控件但对于图片视频网址我不能够得到缩略图。

如何得到这个网址缩略图..例:  http://www.pocketjourney.com/downloads/pj/video/famous.3gp 的

先谢谢了。

解决方案

 的JSONObject jsonResponse = NULL;    尝试{         URL =htt​​p://api.embed.ly/1/oembed?url=www.youtube.com/watch?v=XwGHJJYBs0Q&放大器;了maxWidth = 500;        DefaultHttpClient的HttpClient =新DefaultHttpClient();        Log.v(URL请求, - >中+网址);        URI URI =新的URI(URL);        HTTPGET HTTPGET =新HTTPGET(URI);        httpget.setHeader(接受,应用/ JSON);        httpget.setHeader(内容类型,应用/ JSON的;字符集= UTF-8);        HTT presponse响应= httpClient.execute(HTTPGET);        HttpEntity responseEntity = response.getEntity();        字符串changeTIDRec = EntityUtils.toString(responseEntity);        的System.out.println(changeTIDRec);        jsonResponse =新的JSONObject(changeTIDRec);        Log.v(web服务,回应:+ jsonResponse);    }赶上(例外五){        e.printStackTrace();    }    返回jsonResponse;    JSONObject的JSON =新的WebService()RequestUrl(URL)。            串thumbnail_url;    如果(JSON == NULL){        返回null;    }其他{        串PROVIDER_URL = json.getString(PROVIDER_URL);        的System.out.println(PROVIDER_URL+ PROVIDER_URL);        字符串描述= json.getString(说明);        的System.out.println(说明+说明);        字符串title = json.getString(标题);        的System.out.println(称号+题);        字符串的URL = json.getString(URL);        的System.out.println(URL+网址);        串thumbnail_width = json.getString(thumbnail_width);        的System.out.println(thumbnail_width+ thumbnail_width);         thumbnail_url = json.getString(thumbnail_url);        的System.out.println(thumbnail_url+ thumbnail_url);        字符串版本= json.getString(版本);        的System.out.println(版本+版);        字符串PROVIDER_NAME = json.getString(PROVIDER_NAME);        的System.out.println(PROVIDER_NAME+ PROVIDER_NAME);        字符串类型= json.getString(类型);        的System.out.println(类型+型);        串thumbnail_height = json.getString(thumbnail_height);        的System.out.println(thumbnail_height+ thumbnail_height);}    返回thumbnail_url; 

Hi in my application I am getting image urls and video urls from service. After getting these from service, i am displaying the images in gridview but for video urls i am not able to get the thumbnails.

Android 学习 构建首个Android 应用

how to get the thumbnails for this url.. example: http://www.pocketjourney.com/downloads/pj/video/famous.3gp

Thanks in advance.

解决方案

    JSONObject jsonResponse = null;
    try {
         url="http://api.embed.ly/1/oembed?url="www.youtube.com/watch?v=XwGHJJYBs0Q"&maxwidth=500";
        DefaultHttpClient httpClient = new DefaultHttpClient();
        Log.v("URL request", "--->" + url);
        URI uri = new URI(url);
        HttpGet httpget = new HttpGet(uri);
        httpget.setHeader("Accept", "application/json");
        httpget.setHeader("Content-type", "application/json; charset=utf-8");
        HttpResponse response = httpClient.execute(httpget);
        HttpEntity responseEntity = response.getEntity();
        String changeTIDRec = EntityUtils.toString(responseEntity);
        System.out.println(changeTIDRec);
        jsonResponse = new JSONObject(changeTIDRec);
        Log.v("WebService", "Response : " + jsonResponse);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return jsonResponse;





    JSONObject json = new WebService().RequestUrl(url);
            String thumbnail_url;
    if (json == null) {
        return null;
    } else {
        String provider_url = json.getString("provider_url");
        System.out.println("provider_url"+provider_url);
        String description = json.getString("description");
        System.out.println("description"+description);
        String title = json.getString("title");
        System.out.println("title"+title);
        String urls = json.getString("url");
        System.out.println("url"+urls);
        String thumbnail_width = json.getString("thumbnail_width");
        System.out.println("thumbnail_width"+thumbnail_width);
         thumbnail_url = json.getString("thumbnail_url");
        System.out.println("thumbnail_url"+thumbnail_url);
        String version = json.getString("version");
        System.out.println("version"+version);
        String provider_name = json.getString("provider_name");
        System.out.println("provider_name"+provider_name);
        String type = json.getString("type");
        System.out.println("type"+type);
        String thumbnail_height = json.getString("thumbnail_height");
        System.out.println("thumbnail_height"+thumbnail_height);
}
    return thumbnail_url;