On an Android watch, you need to write information to a *.txt file *.txt To do this, I use the following code:
public boolean write(){ boolean result = true; try { FileOutputStream fOut = context.openFileOutput("text.txt",context.MODE_WORLD_READABLE); fOut.write(createJson().getBytes()); fOut.close(); }catch (FileNotFoundException e) { e.printStackTrace(); result = false; }catch (IOException e) { e.printStackTrace(); result = false; } return result; } And for reading:
public boolean read(){ boolean result = true; try { FileInputStream fin = context.openFileInput("text.txt"); int c; String temp=""; while( (c = fin.read()) != -1){ temp = temp + Character.toString((char)c); } fin.close(); } catch (FileNotFoundException e1) { e1.printStackTrace(); result = false; } catch (IOException e1) { e1.printStackTrace(); result = false; } return result; } The problem is that the MODE_WORLD_READABLE mode MODE_WORLD_READABLE already Deprecated in connection with which the question is, how can I read / write in another way?