存储文件私有

public class SaveAndReadService
{

	public static boolean saveUserInfo(Context context,String username,String password){
		//保存路径 
		try
		{
			FileOutputStream fos = context.openFileOutput("private.txt", Context.MODE_PRIVATE);//在上下文包所对应的目录里创建文件
			
			fos.write((username+"##"+password).getBytes());
			fos.close();
			
			return true;
		} catch (Exception e)
		{
			e.printStackTrace();
			return false;//保存失败
		}
		
	}
	
	
}


你可能感兴趣的:(存储文件私有)