last day (14 days later) » 

3:18 AM
2
A: need to show images from a URL on a list view populated by JSON

LibinThe problem is your trying to access the network URL from main thread. You need to do the network request on the background thread. Use AsyncTask like this new AsyncTask<URL, Integer, Long>(){ @Override protected Long doInBackground(URL... params) { try{...

 
Thank you, but I need your help to use your code proposal inside my code. Would you mind telling me what should I remove or replace with your code?
 
You need to just add your try-catch codes inside doInBackground()
 
i am very sorry, but I am not able to do it as you expect. I am getting lots of errors. You are kindly requested to update your answer including how should the getView() method be changed to include your proposed piece of code, I don't really know how to do it. Of course, if you don't mind.
 
see the updated answer
 
Thank you very much, it doesn't throw any error, but the image is not changed, the default image is shown. I miss there a code line like this one: if (direccionText !=null) direccionText.setText(app.getDireccionEmpresa()); but referred to the imageView1. The method that makes the call for the image name is getImagenEmpresa();
please see the updated question where I have included a screenshot.
 
3:18 AM
post your list item layout
 
Done, you may find it in my question...
 
Do you have INTERNET permission in manifest
 
Hi Libin, thank you for your time. Yes, I have the permission in manifest. As you can see on the screenshot, the two lines of text are got by JSON calls.
If I removed the line android:src="@drawable/facebook" from the layout file, the list appear without any image on the left side, only the two lines of text.
 
can u try to debug
 
yes, of course, what should i look for?
 
3:28 AM
see if any exception.
 
ok, let me try, please
 
keep a breakpoint inside try block and try to do step by step
 
ok, I will call you if I find an exception. Do you think it should work as it is now?
 
yes, it should , I even tested with your layout
I am able to see the image.. Its a flower . right :)
 
yes
I am sorry for the delay, there is a slow internet connection here today..
 
3:40 AM
ok
 
another question, I will change the current URL for the real URL where the images are stored, it is a common URL for all pictures, only the image name change at every object. I can get the picture name calling the method app.getImagenEmpresa(), how could I make this call for every row?
 
I would suggest you to move the AsycTask code to a new class and create instance to the class and you call execute, pass the url execute(url) . you will get the url in doBackground(Url param)
I need to sign off , post your comments if a any other question. will respond tomorrow
 
ok, thank you for your time
 

last day (14 days later) »