本文介绍了无法通过蓝牙共享文件....不发送错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的code。
List<Intent> targetedShareIntents = new ArrayList<Intent>();
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
PackageManager pm =getApplicationContext().getPackageManager();
List<ResolveInfo> activityList = pm.queryIntentActivities(sharingIntent, 0);
for(final ResolveInfo app : activityList) {
String packageName = app.activityInfo.packageName;
Intent targetedShareIntent = new Intent(android.content.Intent.ACTION_SEND);
targetedShareIntent.setType("text/plain");
targetedShareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "share");
if(TextUtils.equals(packageName, "com.facebook.katana")){
targetedShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "http:your link");
} else {
targetedShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, Fragmentactivity.songpaths.get(indexfordelete));
targetedShareIntent.putExtra(Intent.EXTRA_SUBJECT, " Thirukural Version 1.7.2 !");
}
targetedShareIntent.setPackage(packageName);
targetedShareIntents.add(targetedShareIntent);
}
Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Share Application your app name ");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
startActivity(chooserIntent);
我想通过蓝牙共享首先它,但它不工作......
I am trying to share it via bluetooth firstly but it is not working......
我越来越不发送错误文件。
I am getting error File not sent..
下面Fragmentactivity.songpaths.get(indexfordelete)是文件,我想分享的路径。
Here Fragmentactivity.songpaths.get(indexfordelete) is path to file i want to share .
推荐答案
在这里试试这个$ C C I共享文本,U可以共享你想要什么:
try this code here i sharing a text ,u can share what do you want:
List<Intent> targetedShareIntents = new ArrayList<Intent>();
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
PackageManager pm =v.getContext().getPackageManager();
List<ResolveInfo> activityList = pm.queryIntentActivities(sharingIntent, 0);
for(final ResolveInfo app : activityList) {
String packageName = app.activityInfo.packageName;
Intent targetedShareIntent = new Intent(android.content.Intent.ACTION_SEND);
targetedShareIntent.setType("text/plain");
targetedShareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "share");
if(TextUtils.equals(packageName, "com.facebook.katana")){
targetedShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "http:your link");
} else {
targetedShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, strLink);
targetedShareIntent.putExtra(Intent.EXTRA_SUBJECT, " app
version");
}
targetedShareIntent.setPackage(packageName);
targetedShareIntents.add(targetedShareIntent);
}
Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Share Application your app name ");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
startActivity(chooserIntent);
这篇关于无法通过蓝牙共享文件....不发送错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!