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 상황입니다