Java tutorial
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; public class Main { public static Bitmap getPlusBitmap(Context context, String s) { Paint paint = new Paint(); paint.setAntiAlias(true); Bitmap bitmap = BitmapFactory.decodeStream(getCommunityPicInputStream(s)); Bitmap bitmap1; if (bitmap != null) { Bitmap bitmap2 = BitmapFactory.decodeResource(context.getResources(), 0x7f02003f); bitmap1 = Bitmap.createBitmap(bitmap.getWidth() + bitmap2.getWidth() / 2, bitmap.getHeight() + bitmap2.getHeight() / 2, android.graphics.Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap1); canvas.drawARGB(0, 0, 0, 0); canvas.drawBitmap(bitmap, 0.0F, 0.0F, paint); bitmap.recycle(); canvas.drawBitmap(bitmap2, bitmap.getWidth() - bitmap2.getWidth() / 2, bitmap.getHeight() - bitmap2.getHeight() / 2, paint); bitmap2.recycle(); } else { bitmap1 = null; } return bitmap1; } public static InputStream getCommunityPicInputStream(String s) { InputStream inputstream = null; try { inputstream = (new URL( (new StringBuilder()).append("http://service.itouchchina.com/").append(s).toString())) .openConnection().getInputStream(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return inputstream; } }