Skip to content

Instantly share code, notes, and snippets.

@silin
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silin/9543983 to your computer and use it in GitHub Desktop.
Save silin/9543983 to your computer and use it in GitHub Desktop.
Online .pdf file viewer activity
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