I have used this code to share image from drawable folder and its opening "Share intent" with list of available sharing possibilities i.e Bluetooth , Gmail ,FB etc.But on Sending file using Bluetooth gives me error "Unable to Open file for Sharing" when trying to share image from Assets folder while getting error "File not sent" when trying to share file from "drawable folder".Can someone please hele me how to share image file using Android.........here is the Manifest File:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.shareima"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.shareima.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");
Uri imageUri = Uri.parse("android.resource://com.example.shareima/drawable/ic_launcher");
Log.i("imageUri",""+imageUri);
share.putExtra(Intent.EXTRA_STREAM,imageUri);
startActivity(Intent.createChooser(share,"Share Image"));
}
}