Problem Loading Image From Web (android)
public Object fetch(String address) throws MalformedURLException, IOException { URL url = new URL(address); Object content = url.getContent(); return content; } priv
Solution 1:
You are trying to Download a File from the UI Thread...(which is why your UI Freezes)
Use a Seperate Thread or AsyncTask so that your UI doesn't Freeze up.
This should solve your problem.
Solution 2:
As st0le has pointed out you are trying to do the heavy duty stuff from the UI thread.
All heavy-duty stuff in Android should be done on other worker thread. Because doing it in main thread (or the UI thread) can make your application unresponsive and may be killed as the system is persuaded to think that it has hung.
So you have to do the long running operations in separate thread. For implementing this you can use the concept of Handlers.
Post a Comment for "Problem Loading Image From Web (android)"