Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old January 29th, 2013, 12:43 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Question back button returns to wrong activity when opening pdf via uri

Im hoping this is simple, but im fairly confused as to what is going on. I am launching a PDF from an Imagebutton in an android activity using a piece of code I copied from elsewhere in my app.
Code:
if (v==imagebutton20) {

                File file = new File("/sdcard/documents/20.pdf");
                  if (file.exists()) {
                        Uri path = Uri.fromFile(file);
                        Intent intent = new Intent(Intent.ACTION_VIEW);
                        intent.setDataAndType(path, "application/pdf");
                        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                        try {
                            startActivity(intent);
                            overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
                        } 
                        catch (ActivityNotFoundException e) {

                        }
                  }
            }   //end of   load
The pdf loads fine but when i press back the activity that launched the pdf isnt show, instead it returns to the activity before. I have tried commenting out the
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

but the same effect. What am i missing? Sorry but i couldnt make sense of the official android guide, must be having a thick day!

Advertisements
geekyhawkes is offline  
Reply With Quote
sponsored links
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:07 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.