小编Sta*_*ego的帖子

Android API级别<19和"尝试可以使用自动资源管理"警告

我有这段代码

private void copyFile(File src, File dst) throws IOException {

    FileChannel inChannel = new FileInputStream(src).getChannel();
    FileChannel outChannel = new FileOutputStream(dst).getChannel();

    try {

        inChannel.transferTo(0, inChannel.size(), outChannel);

    }finally {

        if(inChannel != null) {

            inChannel.close();

        }

        outChannel.close();

    }

}
Run Code Online (Sandbox Code Playgroud)

产生恼人的警告"尝试可以使用自动资源管理".问题是我不能使用Java 7 try-with-resources导致我的应用程序目标api级别14(如果我使用它会出错).有没有办法压制那令人讨厌的警告?

android try-catch suppress-warnings

15
推荐指数
1
解决办法
3417
查看次数

看看没有eclipse的android logcat

我需要我的朋友在不安装eclipse的情况下查看我的应用程序日志.什么是让他们从我的应用程序中查看日志的最简单/最快的方法?他们只需要安装android-sdk并运行monitor.bat吗?

eclipse android logcat

6
推荐指数
1
解决办法
2748
查看次数

标签 统计

android ×2

eclipse ×1

logcat ×1

suppress-warnings ×1

try-catch ×1