java - Import PDF from adobe -
i looking following in andriod studio
user open mail client , click preview on pdf. opens file in adobe reader.
the user makes comments in adobe , when done press share
my andriod app shown , users selects app
my andriod app gets pdf , saves externally server.
i have part 1,2,3 far not 4,5. understanding can not access applications storage, poster posted this, unsure on how use that?
in order pdf you'll need create activity use case listens "sharing" intents.
shareactivity.java
void oncreate (bundle savedinstancestate) { // intent, action , mime type intent intent = getintent(); string action = intent.getaction(); string type = intent.gettype(); if (intent.action_send.equals(action) && type != null) { if ("application/pdf".equals(type)) { handlepdf(intent); } } else if (intent.action_send_multiple.equals(action) && type != null) { if (type.startswith("application/pdf")) { // handle multiple pdfs being sent } } else { // handle other intents, such being started home screen } } void handlepdf(intent intent) { uri pdfuri = (uri) intent.getparcelableextra(intent.extra_stream); if (pdfuri != null) { // todo: use server-side here save. } }
and add androidmanifest.xml android knows activity when select application share to:
<activity android:name=".ui.shareactivity" > <intent-filter> <action android:name="android.intent.action.send" /> <category android:name="android.intent.category.default" /> <data android:mimetype="application/pdf" /> </intent-filter> </activity>
Comments
Post a Comment