안드로이드 개발 질문/답변
(글 수 45,052)
먼저 파일 내용을 보면,
==================================================================================
01, 엔진경고등(MIL) ,7E0,21,01,7E8,08,01,UBYTE,OFF/ON,000,1.00000 ,0.00000 ,01
02, 배터리전압 ,7E0,21,02,7E8,1E,01,UBYTE, V ,001,0.06810 ,0.00000
03, 냉각수온 센서 ,7E0,21,02,7E8,20,01,UBYTE, ˚C ,001,0.75000 ,-48.00000
.
.
.
.
11
==================================================================================
텍스트 내용을 보면, 총 11줄입니다.
현재 결과는 ===> 리스트뷰에 한줄의 내용만 전부 나열 되는 식으로 나타납니다.
여기서 이상한점은, 나타나는 한줄이 첫번째 줄이 아니라 10번째 줄이 나옵니다;;;;;;;;;
본론으로 들어가면........1~11번째줄 모두를 ListView에 보여줘야 합니다.
고수님들 조언좀 구하려구요.
현재 자바도 같이 공부하고 있습니다;;;
과제기간이 있어서 급한 나머지 이렇게 이것저것 물어보고 있는데요..
답답하시더라도 양해좀요 ㅠㅠ
public class SDcardListViewString extends Activity {
BufferedReader br = null;
StringBuffer sb = new StringBuffer();
byte fileData[] = null;
String strLine = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String path ="/sdcard/";
File file = new File(path+"hdcan_ge_eg33.txt");
try{
FileInputStream fis= new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(fis,"UTF-8"));
while ((strLine = br.readLine()) != null){
sb.append(strLine + "/n");
fis.close();
}
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ArrayList <String> list = new ArrayList <String>();
list.add(strLine);
ArrayAdapter<String> Adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, list);
ListView lv = (ListView) findViewById(R.id.list);
lv.setAdapter(Adapter);
lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
}



