I am working on an app which I will use at school. This app is for reading my homework and such. All this information is stored in PDF file on my schools server, and is accessible by all students. My app is webview based. Whenever I try to load the PDF it will not work. Here is the Android code:
package com.example.emneplanappen;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView wv = (WebView) findViewById(R.id.webView);
wv.setWebViewClient(new WebViewClient());
wv.loadUrl("https://srcurl.dummy/");
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Loading HTML pages with PDF files embedded or as a whole does not render PDFs.