0
LazyAdapter를 사용하여 맞춤 목록보기를 구현하여 축소판 이미지를 표시했습니다. 마지막으로이 LazyAdapter가 작동하면 OnItemClickListener가 데이터를 표시하지 않고 단순히 빈 문자열을 반환합니다. ListView에 대한 사용자 지정 LazyAdapter 클래스를 제거하면 코드가 제대로 작동합니다.ListView LazyAdapter ListView에서 OnItemClickListener가 작동하지 않음
class LoadAllDirectories extends AsyncTask<String, String, String> {
protected String doInBackground(String... args) {
UserFunctions fn = new UserFunctions();
String id = fn.getID(getApplicationContext());
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("id", id));
JSONObject json =
jParser.makeHttpRequest(url_all_directories, "GET", params);
Log.d("All Directories: ", json.toString());
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
directories = json.getJSONArray(TAG_DIRECTORIES);
for (int i = 0; i < directories.length(); i++) {
JSONObject c = directories.getJSONObject(i);
String eid = c.getString(TAG_ID);
String name = c.getString(TAG_NAME);
String image = c.getString(TAG_IMG);
HashMap<String, String> map =
new HashMap<String, String>();
map.put(TAG_ID, eid);
map.put(TAG_NAME, name);
map.put(TAG_IMG, image);
directoryList.add(map);
}
} else {
Intent i = new Intent(getApplicationContext(),
DirectoryActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String file_url) {
runOnUiThread(new Runnable() {
public void run() {
ListAdapter adapter = new LazyAdapter(
DirectoryAllActivity.this, directoryList);
setListAdapter(adapter);
}
});
}
}
}
오류 로그
업데이트 : 복제 로그의 일부가 삭제되었습니다.
11-19 14:17:12.612: W/System.err(16343): java.net.MalformedURLException: Protocol not found: null
11-19 14:17:12.612: W/System.err(16343): at java.net.URL.<init>(URL.java:178)
11-19 14:17:12.612: W/System.err(16343): at java.net.URL.<init>(URL.java:127)
11-19 14:17:12.612: W/System.err(16343): at com.app.android.library.ImageLoader.getBitmap(ImageLoader.java:70)
11-19 14:17:12.612: W/System.err(16343): at com.app.android.library.ImageLoader.access$0(ImageLoader.java:58)
11-19 14:17:12.612: W/System.err(16343): at com.app.android.library.ImageLoader$PhotosLoader.run(ImageLoader.java:135)
11-19 14:17:12.612: W/System.err(16343): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
11-19 14:17:12.622: W/System.err(16343): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-19 14:17:12.622: W/System.err(16343): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-19 14:17:12.622: W/System.err(16343): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
11-19 14:17:12.622: W/System.err(16343): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
11-19 14:17:12.622: W/System.err(16343): at java.lang.Thread.run(Thread.java:856)
11-19 14:17:12.653: D/memalloc(16343): ion: Mapped buffer base:0x5e951000 size:3768320 offset:0 fd:55
그래 내가 진짜를 사용하고 당신의 서버에 분명히있다 "a_web_url"의 데이터 ... URL. 이 게시물의 자리 표시 자일뿐입니다. 웹 서버에서 데이터를 가져옵니다. – user1781367
'url_all_directories = "http://api.androidhive.info/music/music.xml"'을 사용하면 어떻게됩니까? – Sam
글쎄요. 데이터가 SQL 서버에서 왔기 때문에 그 URL을 사용할 수 있는지 잘 모르겠습니다. – user1781367