小编3al*_*lto的帖子

android中Dialog和DialogFragment的区别?

在查看 android 中的文档时,我注意到了 classes: Dialog and DialogFragment( standard , v4 )。教程似乎可以互换使用这些术语,因此我对它们的差异感到困惑。

告诉我我的理解是否正确: aDialogFragment本质上是一个处理生命周期事件的包装器,同时返回一个 Object 类型Dialog,它是实际的 UI 对象?

android dialog dialogfragment

5
推荐指数
0
解决办法
3289
查看次数

如果它们通过java包装在缓冲区中,我是否必须明确关闭所有流?

private InputStream input;
private InputStreamReader inputReader;
private BufferedReader reader;

try {
    input = new InputStream();
    inputStreamReader = new InputStreamReader(inputStream);
    reader = new BufferedReader(inputStreamReader);
    // do I/O operations
} catch (IOException e) {
    Log.d("IOException", "The Data Could Not Be Read =/");
} finally {
    try {
        reader.close(); // now will this, by default, close all other streams? OR
      /*
       * input.close(); inputStream.close(); //is this necessary, along with
       * reader.close();
       */
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

我今天遇到了这个问题,并且不确定它们是否会被关闭,因为它已被包裹,或者是否仍需要独立关闭所有流.

java networking

5
推荐指数
2
解决办法
159
查看次数

标签 统计

android ×1

dialog ×1

dialogfragment ×1

java ×1

networking ×1