Android コードで sharedpreferences ファイルを作成しています。次に、コードでそのファイルを電子メールで送信します。そのためには、sharedpreferences ファイルのパスにアクセスする必要があります。私が使用しているコードは以下のとおりです。しかし、うまくいかないようです。メールを開くことはできますが、ファイルを取得できなかったと思われるため、添付ファイルはありません。誰かがここで解決策を提案できますか。
File f = getDatabasePath("userPrefsFile.xml");
String filelocation=f.getAbsolutePath();
Intent email = new Intent(Intent.ACTION_SEND);
email.setType("application/xml");
String[] to = {"test@test.com"};
email.putExtra(Intent.EXTRA_EMAIL, to);
email.putExtra(Intent.EXTRA_STREAM,filelocation);
email.putExtra(Intent.EXTRA_SUBJECT,"test file send");
startActivity(Intent.createChooser(email, "Send email"));