1
내 안드로이드 코드로 sharedpreferences 파일을 만들고 있습니다. 그런 다음 해당 파일을 내 코드로 전자 메일로 보내려고합니다. 이를 위해 sharedpreferences 파일의 경로에 액세스해야합니다. 내가 사용하고있는 코드는 다음과 같습니다. 그러나 그것은 효과가없는 것처럼 보입니다. 이메일을 열 수는 있지만 파일을 가져올 수 없기 때문에 첨부 파일이 없습니다. 누군가 내게 어떤 해결책을 제안 할 수 있습니까?sharedpreferences 파일의 파일 경로를 얻으십시오
File f = getDatabasePath("userPrefsFile.xml");
String filelocation=f.getAbsolutePath();
Intent email = new Intent(Intent.ACTION_SEND);
email.setType("application/xml");
String[] to = {"[email protected]"};
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"));