Android Open Source - steam-sales-mobile Http Thumbnails






From Project

Back to project page steam-sales-mobile.

License

The source code is released under:

GNU General Public License

If you think the Android project steam-sales-mobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
Steam Sales Mobile - Android application to keep track of the steam sales.
        Copyright (C) 2013  Mathieu Rhaume <mathieu@codingrhemes.com>
/*ww w  .jav a2s .  co m*/
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
*/

package com.codingrhemes.steamsalesmobile;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import java.io.InputStream;

// Class that downloads those pictures!!
public class HttpThumbnails {
    public static Bitmap readPictureFromTheWeb(String URL) {
        HttpClient httpClient = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(URL);
        Bitmap thePicture = null;

        try {

            HttpResponse response = httpClient.execute(httpGet);
            StatusLine statusLine = response.getStatusLine();
            int statusCode = statusLine.getStatusCode();
            if (statusCode == 200) {
                HttpEntity entity = response.getEntity();
                InputStream inputStream = entity.getContent();
                thePicture = BitmapFactory.decodeStream(inputStream);
                inputStream.close();
            } else {
                Log.d("JSON", "Failed to download file");
            }
        } catch (Exception e) {
            Log.d("HttpThumbnails", e.getLocalizedMessage());
        }
        return thePicture;
    }
}




Java Source Code List

com.codingrhemes.steamsalesmobile.AboutActivity.java
com.codingrhemes.steamsalesmobile.BuildConfig.java
com.codingrhemes.steamsalesmobile.CustomArrayAdapter.java
com.codingrhemes.steamsalesmobile.GameSaleActivity.java
com.codingrhemes.steamsalesmobile.Game.java
com.codingrhemes.steamsalesmobile.HttpThumbnails.java
com.codingrhemes.steamsalesmobile.JSON.java