2013년 6월 23일 일요일

NetworkOnMainThreadException

I got the NetworkOnMainThreadException. So I used Aynctask to avoid the error, but I got  the same error. I googled about this, and I found out that if strict mode turned on, the error shows up even though I use Asynctask. I used LruCache, and the cache got the strict mode turn on. I turned off the strict mode, now the error disappeared. The following is how to turn off the strict mode.


StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);

댓글 없음:

댓글 쓰기