Saving files on external storage on Nexus 7 and retrieving from PC

为君一笑 提交于 2019-11-28 12:30:10

Have you tried using a terminal with "adb pull filename" and the full pathname that Astro sees? That ought to work, and if you're using this yourself wouldn't be too hard.

I experienced this as well (on my Nexus 4). The file existed on my phone (found it using adb shell), but my file explorer on my laptop couldn't find the file. Like @billtian said, this seems to be a bug on Nexus 4 and 7 devices. I tried out my code on an old Ericsson Xperia and there I could locate the file via my laptop.

Why, best not to send it to your mail. See the following example:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"email@example.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "subject here");
intent.putExtra(Intent.EXTRA_TEXT, "body text");
File root = Environment.getExternalStorageDirectory();
File file = new File(root, xmlFilename);
if (!file.exists() || !file.canRead()) {
    Toast.makeText(this, "Attachment Error", Toast.LENGTH_SHORT).show();
    finish();
    return;
}
Uri uri = Uri.parse("file://" + file.getAbsolutePath());
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Send email..."));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!