簡體   English   中英

創建文件並在Android Studio中以調試模式檢查它

[英]Create file and check it in debug mode in Android Studio

我正在使用android studio,並使用連接的設備(即手機)進行調試。 創建文件后我一直在徘徊,如何才能實際看到該文件。 我的意思不是以編程方式。

這是將xml文件復制到內部存儲器的代碼。 看來它已被復制,但我看不到並確認。 反正在Android Studio中有檢查嗎?

File file = new File("server.xml");
    try {
        Context context = getApplicationContext();
        InputStream inputStream = context.getResources().openRawResource(R.raw.server);
        FileOutputStream fileOutputStream = new FileOutputStream(file);

        byte buf[]=new byte[1024];
        int len;
        while((len=inputStream.read(buf))>0) {
            fileOutputStream.write(buf,0,len);
        }

        fileOutputStream.close();
        inputStream.close();
    } catch (IOException e1) {}

您可以這樣做:

adb shell run-as your.package.name
cat files/server.xml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM