Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>//------------------------------WRITING DATA TO THE FILE --------------------------------- btnWriteSDFile.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { File myFile = new File("/sdcard/mysdfile.txt"); myFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(myFile); OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut); myOutWriter.append(txtData.getText()); myOutWriter.close(); fOut.close(); Toast.makeText(v.getContext(),"Done writing SD 'mysdfile.txt'", Toast.LENGTH_SHORT).show(); txtData.setText(""); } catch (Exception e) { Toast.makeText(v.getContext(), e.getMessage(),Toast.LENGTH_SHORT).show(); } } }); //---------------------------READING DATA FROM THE FILE PLACED IN SDCARD-------------------// btnReadSDFile.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { File myFile = new File("/sdcard/mysdfile.txt"); FileInputStream fIn = new FileInputStream(myFile); BufferedReader myReader = new BufferedReader(new InputStreamReader(fIn)); String aDataRow = ""; String aBuffer = ""; while ((aDataRow = myReader.readLine()) != null) { aBuffer += aDataRow ; } txtData.setText(aBuffer); myReader.close(); Toast.makeText(v.getContext(),"Done reading SD 'mysdfile.txt'",Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(v.getContext(), e.getMessage(),Toast.LENGTH_SHORT).show(); } } }); </code></pre> <p>ALONG WITH THIS ALSO WRITE THIS PERMISSION IN Android.Manifest</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload