Java tutorial
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.util.Properties; import android.app.Activity; import android.content.Context; public class Main { public static void saveAccount(Activity act, String account, String psw) { String str = account + "," + psw; Properties localProperties = new Properties(); localProperties.put("account", str); try { File file = new File(act.getFilesDir() + "/accout.cfg"); if (!file.exists()) file.createNewFile(); FileOutputStream localFileOutputStream = act.openFileOutput("account.cfg", Context.MODE_PRIVATE); localProperties.store(localFileOutputStream, ""); localFileOutputStream.close(); } catch (Exception localException) { localException.printStackTrace(); } } }