forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAction.java
More file actions
32 lines (28 loc) · 1.16 KB
/
Action.java
File metadata and controls
32 lines (28 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.renpy.android;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.app.Activity;
import android.util.Log;
public class Action {
static Context context;
/* Deliver some data to someone else
*/
static void send(String mimeType, String filename, String subject, String text, String chooser_title) {
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType(mimeType);
/** tryied with String [] emails, but hard to code the whole C/Cython part.
if (emails != null)
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emails);
**/
if (subject != null)
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
if (text != null)
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
if (filename != null)
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filename));
if (chooser_title == null)
chooser_title = "Send mail";
context.startActivity(Intent.createChooser(emailIntent, chooser_title));
}
}