마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

리스트뷰 다중선택 이벤트 가능할까요??

0 추천
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Toast.makeText(mParent, items.get(position), Toast.LENGTH_LONG).show();


                String a = null;
                String b = null;
                String c = null;
                String d = null;

                if (position == 0) {
                    StringTokenizer tokens = null;
                    try {
                        BufferedReader br1 = new BufferedReader(new FileReader(new File("/sdcard/Download/userconfig.txt")));


                        for (i = 0; i < 1; i++) {
                            result = br1.readLine();
                        }
                        tokens = new StringTokenizer(result, ",");

                        br1.close();
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    a = tokens.nextToken();
                    b = tokens.nextToken();
                    c = tokens.nextToken();
                    d = tokens.nextToken();


                    Bitmap tempBitmap = onon.copy(onon.getConfig(), true);
                    Canvas canvas = new Canvas(tempBitmap);
                    Paint paint = new Paint();
                    paint.setColor(0xFFFF0000);
                    paint.setStyle(Paint.Style.STROKE);
                    canvas.drawRect(Float.parseFloat(a), Float.parseFloat(b), Float.parseFloat(c), Float.parseFloat(d), paint);
                    image1.setImageBitmap(tempBitmap);



                } else {

                }

                if (position == 1) {
                    a = null;
                    b = null;
                    c = null;
                    d = null;
                    StringTokenizer tokens = null;
                    try {
                        BufferedReader br2 = new BufferedReader(new FileReader(new File("/sdcard/Download/userconfig.txt")));


                        for (i = 0; i < 2; i++) {
                            result = br2.readLine();
                        }
                        tokens = new StringTokenizer(result, ",");

                        br2.close();
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    a = tokens.nextToken();
                    b = tokens.nextToken();
                    c = tokens.nextToken();
                    d = tokens.nextToken();

                    Bitmap tempBitmap = onon.copy(onon.getConfig(), true);
                    Canvas canvas = new Canvas(tempBitmap);
                    Paint paint = new Paint();
                    paint.setColor(0xFFFF0000);
                    paint.setStyle(Paint.Style.STROKE);
                    canvas.drawRect(Float.parseFloat(a), Float.parseFloat(b), Float.parseFloat(c), Float.parseFloat(d), paint);
                    image1.setImageBitmap(tempBitmap);


                }

안녕하세요 리스트뷰로 앱 개발을 하고 있습니다

위 소스코드는 리스트뷰(다중체크) 이벤트부분인데 

제가 구현하고싶은 기능은 position 0번과 포지션1번이 같이 눌렸을때 이벤트와 이중 한가지의 체크가 풀렸을시에 이벤트를 구현하고싶습니다.

 

총 포지션은 0~6 이며, 리스트뷰 밑에는 이미지뷰가있어 체크이벤트마다 사각형을 다른위치에 그릴 예정입니다. 지금현재 문제는 체크0번을 선택하면 이벤트 -> 체크1번을 선택하면 1번에대한 이벤트만 발생

여기서 1번을 풀면 이벤트 X 상황입니다

도깨비입술 (180 포인트) 님이 2017년 6월 1일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...