File file = null; //전역변수 설정
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBatteryText = (TextView)findViewById(R.id.battery);
adc = (TextView)findViewById(R.id.textView1);
test = (TextView)findViewById(R.id.textView4);
file = new File("sys/class/power-supply/battery/batt_current_adc");
readFile(file);
}
protected void readFile(File file) {
// TODO Auto-generated method stub
int readcount=0;
if(file!=null && file.exists()){
try {
FileInputStream fis = new FileInputStream(file);
readcount = (int)file.length();
byte[] buffer = new byte[readcount];
fis.read(buffer);
for(int i=0 ; i<file.length();i++){
//Log.d(TAG, ""+buffer[i]);
}
String ff = buffer.toString();
adc.setText(ff);
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
값을 못읽어옵니다.
30번줄 setText에 아무것도 나오질 않아요;
어디가 잘못됐을까요?