使用文档中的数据存储页面,我试图将一些数据存储到SD卡中.这是我的代码:
// Path to write files to
String path = Environment.getExternalStorageDirectory().getAbsolutePath() +
"/Android/data/"+ctxt.getString(R.string.package_name)+"/files/";
String fname = "mytest.txt";
// Current state of the external media
String extState = Environment.getExternalStorageState();
// External media can be written onto
if (extState.equals(Environment.MEDIA_MOUNTED))
{
try {
// Make sure the path exists
boolean exists = (new File(path)).exists();
if (!exists){ new File(path).mkdirs(); }
// Open output stream
FileOutputStream fOut = new FileOutputStream(path + fname);
fOut.write("Test".getBytes());
// Close output stream
fOut.flush();
fOut.close();
} catch …
Run Code Online (Sandbox Code Playgroud) 由于LOCK_PATTERN_ENABLED已移至Froyo中的Settings.Secure,我的应用无法再锁定屏幕...
有没有人知道这个的解决方法?我的应用程序可以立即锁定屏幕的任何方式?无论是自动锁模式还是某种自定义锁屏......