In my app i am sending WAV file as attachment in email.while showing the email chooser the Indent.createChooser intent will list the email,gmail,facebook,skype,bluetooth and other unnecessary option it. i want to show only the Email and Gmail option. i do not know how to do that? Before you its possibly duplicate question i saw the following link and its does not help me.
As told in the above links i have tried sendIntent.setType("audio/rfc822");
. Again it is display the same.
my code sample:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://" + f.getAbsolutePath()));
sendIntent.setType("audio/wav");
startActivity(Intent.createChooser(sendIntent, "Email file"));
Updated Question:
i have implemented a sample with listing installed app and click item on the list view i will launch the Gmail / Email app: it is says "No Application can perform this operation".
To list the app in the list view:
-----------------
List<PackageInfo> packs = packageManager.getInstalledPackages(0);
for(int i = 0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
ApplicationInfo a = p.applicationInfo;
if ((includeSysApps) && ((a.flags & ApplicationInfo.FLAG_SYSTEM) == 1)) {
continue;
}
App app = new App();
app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
app.setPackageName(p.packageName);
app.setVersionName(p.versionName);
app.setVersionCode(p.versionCode);
app.setInstallDir(p.applicationInfo.sourceDir);
app.setInstallSize(calculateSize(app.getInstallDir()));
CharSequence description = p.applicationInfo.loadDescription(packageManager);
app.setDescription(description != null ? description.toString() : "");
apps.add(app);
-----------
and in the onclick item event is:
Intent sendIntent = new Intent(getPackageManager().getLaunchIntentForPackage(app.getPackageName()));
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://" + Environment.getExternalStorageDirectory().getPath()+"/Music/SalsaFav.mp3"));
sendIntent.setType("audio/wav");
startActivity(Intent.createChooser(sendIntent, "Email file"));
please help me.