Activity 화면 갱신처리를 하는 방법때문에 다양한 걸 검색해서 찾았다.
public void onClick (View v){
Intent intent = getIntent();
finish();
startActivity(intent);
}
이 코드는 현재 화면을 다시 Refresh 하는 코드다.
따라서 검색어를 입력하고 검색결과를 찾는 경우에는 부적합하다.
데이터를 삭제하고 화면을 갱신해야 하는 경우에는 유용하다.
The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread.
서버에서 데이터 및 사진이미지를 가져와서 ListView 에 갱신처리하는 걸 구현하는데 이런 메시지가 나오면서 간혹 앱이 강제종료된다.
무엇이 문제일까?
AsyncTask.execute(new Runnable() 에서 처리한 결과가 listViewAdapter.notifyDataSetChanged(); 보다 늦게 나오면서 생기는 문제였다. 결국 이런 로직을 사용하면 안된다는 것이다. 처리순서가 순차적으로 되지 않고 아래 코드가 먼저 실행되면서 발생하는 문제였다. |
protected void showList() { |
도움이 되는 내용이 있어서 적어둔다.
http://www.vogella.com/tutorials/AndroidListView/article.html
'안드로이드 > 버그탈출' 카테고리의 다른 글
permission denied for this window type/BadTokenException (0) | 2017.05.11 |
---|---|
Android Studio 액션바(상단바) 없애기 (0) | 2017.05.09 |
Intent.ACTION_CALL (0) | 2017.04.14 |
Android 패키지 파일을 분할하는 중에 문제가 발생하였습니다. (0) | 2017.04.07 |
showDialog(int) from the type Activity is deprecated (0) | 2017.04.05 |