I have to download an image from an url. Do you recommend Bitmap or Drawable? Whatever, I have tried twice, but those don't work. Do you know what could be the problem?? (I have written the internet and the external storage permissions). You will see that I recieve the URL by a JSON object, but I was recieved correctly.

If I want to recieve it in a Drawable element:

```
protected Drawable getDrawable()
    {
        try{
            JSONObject jsonResponse = new JSONObject(content);
            String src=jsonResponse.getString(data);
            InputStream is = (InputStream)new URL(src).getContent();
            Drawable d=Drawable.createFromStream(is, "basket.png");
            return d;
        }
        catch(Exception e)
        {
            String err="This is the error: ";
            Log.e(err,e.getMessage());
            //e.printStackTrace();
            return null;
        }
    }

```

If I want to recieve it un a Bitmap element:

```
protected Bitmap getBitMap()
    {
        try{
            JSONObject jsonResponse = new JSONObject(content);
            String src=jsonResponse.getString(data);
            java.net.URL url = new java.net.URL(src);
            HttpURLConnection con=(HttpURLConnection)url.openConnection();
            con.setDoInput(true);
            con.connect();
            InputStream input=con.getInputStream();
            Bitmap myBitmap=BitmapFactory.decodeStream(input);
            return myBitmap;
        }
        catch(Exception e){
            String err="This is the error: ";
            Log.e(err,e.getMessage());
            //e.printStackTrace();
            return null;
        }
    }

```

This is where I have the ImageView:

```
public class Accedido extends AppCompatActivity {

    ImageView imagen;
    Button ok;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_accedido);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        imagen=(ImageView)findViewById(R.id.Img);
        ok=(Button)findViewById(R.id.btnOk);
        ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Bitmap img=null;
                Ajax im=new Ajax();
                try {
                    String imagen = im.execute(MainActivity.IP_ADDRESS + "Imagen").get();
                    LeerConsulta lec = new LeerConsulta(imagen, "img");
                    //img=lec.getBitMap();
                    /*String res=lec.getContent();
                    String res2=lec.getData();
                    Toast.makeText(Accedido.this, "Content:"+res+"Data:"+res2, Toast.LENGTH_LONG).show();*/
                    img=lec.getBitMap();
                }
                catch(Exception exc) {
                    Toast.makeText(Accedido.this, exc.getMessage(), Toast.LENGTH_SHORT).show();
                }
                imagen.setImageBitmap(img);
            }
        });
    }

```

When I run those codes, the program throws me an error which says `println needs a message`...But I have never written in the program a system.out.println