I try this but work only for text no out the data....Any help? public void blinkLED(View v){ //Find the directory for the SD Card using the API //*Don't* hardcode "/sdcard" String line = null; File sdcard = Environment.getExternalStorageDirectory();
//Get the text file File file = new File(sdcard,"LEDstate.txt"); //Read text from file StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader(file)); //String line; while ((line = br.readLine()) != null) { // mOutputStream.write(line.getBytes()); text.append(line); text.append('\n'); } } catch (IOException e) { //You'll need to add proper error handling here } //Find the view by its id TextView tv = (TextView)findViewById(R.id.textView2); //Set the text tv.setText(text); if (mOutputStream != null) { try { mOutputStream.write(text.getBytes()); } catch (IOException e) { // TODO Auto-generated catch block Log.e(TAG, "write failed", e); } } I think the wrong is when convert text to byte...my file is 1 byte 0 or 1.... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en