小编BBo*_*oom的帖子

在Android中存储SD卡上的数据

使用文档中数据存储页面,我试图将一些数据存储到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)

android sd-card

7
推荐指数
1
解决办法
8148
查看次数

锁定Android手机(锁定模式或类似)

由于LOCK_PATTERN_ENABLED已移至Froyo中的Settings.Secure,我的应用无法再锁定屏幕...

有没有人知道这个的解决方法?我的应用程序可以立即锁定屏幕的任何方式?无论是自动锁模式还是某种自定义锁屏......

android design-patterns locking

5
推荐指数
1
解决办法
2259
查看次数

标签 统计

android ×2

design-patterns ×1

locking ×1

sd-card ×1