系统4.0.3以后的
File file=new File("");
Uri uri1 = Uri.fromFile(file);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
//intent.setType("audio/*");
intent.setType("application/octet-stream");
ComponentName comp=new ComponentName("com.mediatek.bluetooth","com.mediatek.bluetooth.BluetoothShareGatewayActivity");
intent.setComponent(comp);
intent.putExtra(Intent.EXTRA_STREAM, uri1);
startActivity(intent);
系统4.0.3以前的
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
//这个类型函数是自己工具类的方法,你可以自己设置文件类型,例如图片文件:image/*
//不想写类型直接*/*也是可以的
intent.setType("audio/*");
//这里setClassName就是指定蓝牙,不写这句就弹出选择用什么发送
//有蓝牙啊,gmail啊,彩信之类的
intent.setClassName("com.android.bluetooth" , "com.android.bluetooth.opp.BluetoothOppLauncherActivity");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("")));
startActivity(intent);
ArrayList<Uri> uris = new ArrayList<Uri>();
uris.add(Uri.fromFile(new File("/sdcard/111.txt")));
uris.add(Uri.fromFile(new File("/sdcard/222.txt")));
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND_MULTIPLE);
intent.setType("video/*");
intent.setClassName("com.android.bluetooth" , "com.android.bluetooth.opp.BluetoothOppLauncherActivity");
//intent.setClassName("com.mediatek.bluetooth","com.mediatek.bluetooth.BluetoothShareGatewayActivity");
//intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/111.txt")) );
//intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/222.txt")));
intent.putExtra(Intent.EXTRA_STREAM, uris);
startActivity(intent);