Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.InputStream;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    public static final String DOMAIN = "http://192.168.1.123:3000";

    public static Bitmap getBitmapFromWeb(String imageURL) {
        Bitmap bitmap = null;
        if (imageURL != null && imageURL.compareTo("null") != 0) {
            try {
                InputStream in = new URL(DOMAIN + imageURL).openStream();

                bitmap = BitmapFactory.decodeStream(in);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return bitmap;
    }
}