json으로 데이터를 받아서 listview를 만들었는데요 너무 데이터가 많아서 게시글 10개 가져올때마다 wait()를 써서 일시정지하고 맨아래 더보기 버튼을 눌렀을때 notify()를써서 다시 갱신할려고하는데 이렇게하면 안되는 건가요?? 계속 강제종료가 되요
final StunoteJsonReadTask task = new StunoteJsonReadTask(adapter);
try {
String resultTask = task.execute(url).get();
Log.e("msg : ",resultTask);
} catch (InterruptedException e) {
e.printStackTrace();
Log.e("msg : ","error");
} catch (ExecutionException e) {
e.printStackTrace();
Log.e("msg : ","error");
}
Button btn = (Button) view.findViewById(R.id.StuListMoreBtn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
task.notify();
}
});
return view;
protected void onPostExecute(String result) {
super.onPostExecute(result);
try{
JSONObject jsonResponse = new JSONObject(result);
JSONArray jsonMainNode = jsonResponse.optJSONArray("major_document");
for(int i = 0;i<jsonMainNode.length();i++)
{
if(i != 0 && i % 10 == 0){
this.wait();
}
JSONObject jsonChildNode = jsonMainNode.getJSONObject(i);
String document_srl = jsonChildNode.optString("document_srl");
String title = jsonChildNode.optString("title");
String content = jsonChildNode.optString("content");
String regDate = jsonChildNode.optString("regdate");
String readed_count = jsonChildNode.optString("readed_count");
String commentCount = jsonChildNode.optString("comment_count");
ListViewItem tempList = new ListViewItem();
adapter.addItem(document_srl,title,content,regDate,readed_count,commentCount);
}
adapter.notifyDataSetChanged();
Log.e("msg : ","입력 완료");
}catch(JSONException e){
Log.e("msg : ","JSON 오류");
}catch (InterruptedException e) {
Log.e("msg : ","Wait 오류");
}
}