Last active
August 29, 2015 13:57
-
-
Save silin/9543983 to your computer and use it in GitHub Desktop.
Online .pdf file viewer activity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OnlinePdfViewActivity extends Activity { | |
public static final String KEY_PDF_URL = "KEY_PDF_URL"; | |
private static final String GOOGLE_API_URL = "https://docs.google.com/gview?embedded=true&url="; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
WebView view = new WebView(this); | |
view.getSettings().setJavaScriptEnabled(true); | |
setContentView(view); | |
String pdfUrl = getIntent().getStringExtra(KEY_PDF_URL); | |
view.loadUrl(GOOGLE_API_URL + pdfUrl); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment