Hi
ich versuche in meiner Video App, ein ausgewähltes Video von der SD Karte an eine Email anzuhänge...leider bisher ohne Erfolg...da ich mittlerweile schon alles, was ich über dieses Thema finden konnte, ausprobiert habe, wende ich mich an euch und hoffe, dass mir jemand behilflich sein kann. Das wäre wirklich super, denn langsam bin ich echt am verzweifeln ... Vielen Dank...
Das hier ist mein Code:
Das onClick Event...
Java
vGrid.setOnItemClickListener(new OnItemClickListener() {
// click on item and open options menu
public void onItemClick(AdapterView parent, View v, int position, long id) {
//get uri of selected/clicked video
String [] proj={MediaStore.Video.Media.DATA};
videocursor = managedQuery( MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj, null,null,null);
videocursor.moveToPosition(position);
Uri uri = Uri.parse(videocursor.getString(0));
Log.d("EditGalleryView", "pos: "+position+", uri: "+uri);
// print the filename
Toast.makeText(EditGalleryView.this, "You just selected " +uri, Toast.LENGTH_SHORT).show();
openOptionsMenu(); //Opens Options Menu by clicking a video
}
});
Alles anzeigen
Das onOptionsItemSelected Event:
Java
public boolean onOptionsItemSelected (MenuItem item){ ...
else if (item.getItemId() == R.id.menu_email)
{
//TODO open YouTube
/*new AlertDialog.Builder(this)
.setTitle("No Service")
.setMessage("Sorry, Email is not supported yet!")
.setNeutralButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}}).show();*/
//Uri uri = Uri.parse("file://" + videocursor.getString(0));
Uri uri = Uri.fromFile(new File(videocursor.getString(0)));
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
sendIntent.setType("video/3gp");
sendIntent.setType("video/mp4");
startActivity(sendIntent);
Log.d("EditGallerView path", uri.toString());
return true;
}
...
return super.onContextItemSelected(item);
}
Alles anzeigen
und mein logcat output...
Java
7-21 01:15:17.663: INFO/ActivityManager(53): Starting activity: Intent { act=android.intent.action.SEND typ=video/mp4 cmp=com.android.mms/.ui.ComposeMessageActivity (has extras) } 07-21 01:15:17.693: DEBUG/EditGallerView path(234): file:///sdcard/Video0006.mp4
07-21 01:15:17.853: INFO/NotificationService(53): enqueueToast pkg=com.android.mms callback=android.app.ITransientNotification$Stub$Proxy@43d56a70 duration=0
07-21 01:15:18.032: DEBUG/dalvikvm(103): GREF has increased to 201
07-21 01:15:18.333: WARN/InputManagerService(53): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@43cc1e98 (uid=10024 pid=234)
07-21 01:15:18.433: INFO/ActivityManager(53): Displayed activity com.android.mms/.ui.ComposeMessageActivity: 726 ms (total 726 ms)
07-21 01:15:23.543: DEBUG/dalvikvm(159): GC freed 306 objects / 12024 bytes in 89ms
07-21 01:15:28.553: DEBUG/dalvikvm(234): GC freed 1255 objects / 72056 bytes in 102