기본 콘텐츠로 건너뛰기

gsjava 안드로이드 리스트뷰 전체 삭제

<ListView    android:id="@+id/resultlv"    android:layout_width="match_parent"    android:layout_height="366dp"    android:layout_alignParentTop="true"    android:layout_centerHorizontal="true"    android:layout_marginBottom="30dp"    android:layout_marginTop="115dp"    android:choiceMode="singleChoice" />
private ArrayList items = null;
private ArrayAdapter adapter = null;
// 빈 데이터 리스트 생성.
items = new ArrayList() ;
// ArrayAdapter 생성. 아이템 View를 선택(single choice)가능하도록 만듦.adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_single_choice, items) ;

listview.setAdapter(adapter) ;

listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override    public void onItemClick(AdapterView parent, View v, int position, long id) {

        // get TextView's Text.        String strText = (String) parent.getItemAtPosition(position) ;

        Toast.makeText(getApplicationContext(), strText, Toast.LENGTH_LONG).show();
    }
}) ;
// 아이템 추가.items.add(strText);
//items.add(strText + Integer.toString(count + 1));
// listview 갱신adapter.notifyDataSetChanged();
//아이템 전체 삭제items.clear();
// listview 갱신adapter.notifyDataSetChanged();
출처: http://developmentlee.tistory.com/91?category=796972 [developmentlee]

댓글

이 블로그의 인기 게시물

UltraEdit Professional Version 18.20.0.1014 라이센스 키 넣기

Step 1: unpack rar archive      Step 2: run the setup   Step 3: Use the given keygen to activate    Add the line   127.0.0.1 licensing.ultraedit.com         to your %WINDOWS%\system32\drivers\etc\hosts file                 Enter any data for license-id and password (license-id must be a         number)                 Choose Offline activation and generate corresponding activation         codes for your user codes   Step 4: Enjoy and Support Developers, Buy It, They Deserved It!

dmesg 메시지 실시간으로 보기

참조사이트 http://imitator.kr/Linux/556 # tail -f /var/log/messages # tail -f |dmesg //기본 2초 단위로 갱신 된다. # watch "dmesg | tail -f" //1초 단위로 갱신하면서 보여준다. # watch -n 1 "dmesg | tail -f" // 보여주는 줄을 20으로 늘린다. (기본 10줄) # watch -n 1 "dmesg | tail -f -n 20"