if(v.getId()==R.id.button4){
}
버튼 4를 누르고
1이라는 숫자가 입력되어있으면 바로 뒤에 똑같이 1이 붙게해주는
예를 들어 11<-이렇게 1뒤에 바로 1이 붙는
append 코딩을 모르겠어요.
아시는 분 답변부탁드립니다@ ㅠ ㅠ
try {
in = openFileInput(LOCAL_FILE);
}catch (FileNotFoundException e){
in = getResources().openRawResource(R.raw.data);
}
editText01 = (EditText)findViewById(R.id.editText); //editText.레이아웃 연결.
try {
reader = new BufferedReader(new InputStreamReader(in,"UTF-8"));
String s;
while ( (s = reader.readLine()) != null) { //한 줄씩 읽어서 처리.
editText01.append(s); //s 객체를 첨부
editText01.append("\n");
}
}catch (IOException e){
Log.e("LOCAL_FILE",e.getMessage());
}
}
@Override
public void onClick(View v) {
if(v.getId() == R.id.button2){
editText01.setText(""); //텍스트 초기화
}
if(v.getId() == R.id.button3){
finish(); //종료.
}
if(v.getId() ==R.id.button){
editText01 = (EditText)findViewById(R.id.editText);// editText에 레이아웃 연결
String s = editText01.getText().toString(); //텍스트 추출
if(s.length() == 0){
deleteFile(LOCAL_FILE);
return;
}
try{
OutputStream out = openFileOutput(LOCAL_FILE,MODE_PRIVATE);
PrintWriter writer = new PrintWriter(new OutputStreamWriter(out,"UTF-8")); //특정한 문자단위 작성
writer.append(s);
writer.close();
}
catch (IOException e){
Log.e("Local File", e.getMessage());
}
if(v.getId()==R.id.button4){
}
}
}
그리고 주석 처리 해주실 수 있으신가요?
제가 안드로이드 처음시작하는데 이해하기 어렵네요....
제가 몇개는 주석처리해서 써놓긴 했는데 맞는 지 모르겠습니다.
혹시 틀리다면 보완할점과 추가설명도 부탁드립니다 ㅠㅠ