1 package be
.nikiroo
.fanfix
.reader
.android
;
3 import android
.app
.Activity
;
4 import android
.content
.Intent
;
5 import android
.net
.Uri
;
8 import java
.io
.IOException
;
10 import be
.nikiroo
.fanfix
.reader
.BasicReader
;
12 public class AndroidReader
extends BasicReader
{
18 private AndroidReader() {
19 // Required for reflection
22 public AndroidReader(Activity app
) {
27 public void read() throws IOException
{
31 public void browse(String source
) {
35 protected void start(File target
, String program
) throws IOException
{
36 if (program
== null) {
38 Intent
[] intents
= new Intent
[] { //
39 new Intent(Intent
.ACTION_VIEW
), //
40 new Intent(Intent
.ACTION_OPEN_DOCUMENT
) //
43 for (Intent intent
: intents
) {
44 intent
.setDataAndType(Uri
.parse(target
.toURI().toString()),
48 Intent chooserIntent
= Intent
.createChooser(intents
[0],
51 // chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
54 app
.startActivity(chooserIntent
);
55 } catch (UnsupportedOperationException e
) {
56 super.start(target
, program
);
59 super.start(target
, program
);