How to add a image into menu from url I will show how to add a image from url like a Drawable object You will need this references. In this case we will use this method import android.graphics.drawable.Drawable; import android.graphics.drawable.BitmapDrawable; import java.net.URL; import java.net.HttpURLConnection; import android.graphics.BitmapFactory.Options; import android.graphics.Bitmap; import java.io.ByteArrayOutputStream; You could be need add this policy into main activity. StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); You can use this method into your class public static Drawable getImageByteUrl(Context context,String url) { Drawable image = null; try { URL image...
Comments
Post a Comment