Plan to develope an android application for open web pdf links in my android application.am opening in webview.But its not good to feel its like a pdf.so thats why plan to open in any adobereader application is installed or any other pdfviewer supported applications already installed in android devise open in thar application or open in webbrowser.
my sample code :1
public class MyPdfViewActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView mWebView=new WebView(MyPdfViewActivity.this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
setContentView(mWebView);
}
}
sample code 2:
open in webbrowser
How can i open pdf like in ios webview in android with supported guestures and all.
I think, this will help you to some extent: https://github.com/manjusdm/PDFReader
Related
I'm using the standard Android SDK with Ecliple as provided from the Android website.
What I want to to is to have an activity display a WebView that loads a local HTML-file. Everything works fine until I try to load the webview.
I've placed all the index-files I've tried in the project's assets-folder.
This is the code in my activity:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_assets/www/index.html");
setContentView(webView);
}
When I run the app over ADB, I get the following message in the WebView:
Webpage not available
The webpage at file:///android_assets/www/index.html might be temporarily down or it may have moved permanently to a new web address.
I know this problem has been posted before, and I've tried every single solution out there. But it just won't load. It displays online http-addresses just fine, but it doesn't seem to find any of the local files.
Please help me, this drives me mad.
Change this line:
webView.loadUrl("file:///android_assets/www/index.html");
to this :
webView.loadUrl("file:///android_asset/www/index.html");
is android_asset not android_assets :D. Good Luck
I am new to android programming and I am developing my first apps using eclipse.
I have kept my html and jquery codes inside assets folder.
now this is my code in mainactivity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = (WebView)findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
// webView.setWebChromeClient(new WebChromeClient);
webView.loadUrl("file://android_asset/www/index.html");
}
when i installed app on my device and run it,
it says,
webpage not available,
the file at file://android_asset/www/index.html may have been moved permanently
plz help me to solve this
Try changing
webView.loadUrl("file://android_asset/www/index.html");
by
webView.loadUrl("file:///android_asset/www/index.html"); // please see the extra forward slash, they have to be 3.
hi I have Android App as I embed HTML file , I added my code and when I test the app I noticed that some of css classes doesn't called as #media also the JQuery doesn't called .
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_elaraby_group);
WebView wv=(WebView) findViewById(R.id.web_engine);
wv.loadUrl("file:///android_asset/index.html");
}
Well you have to provide exact same structure you are using in html page in your asses folder.Otherwise it will not get some files referenced in your html file.And hence those CSS and JavaScript code never gets run.So try with providing same structure as your localhost server.
I'm trying to develop an Android application which only shows a video streaming embedded as follows:
<html>
<embed width="650" height="377 "flashvars="backcolor=111111&frontcolor=CCCCCC&lightcolor=66CC00&autostart=true&skin=http://manage.streamcyclone.com/skins/snel.zip&streamer=rtmp://sc-lb1.streamcyclone.com/janakles_live&file=janakles&plugins=http://manage.streamcyclone.com/plugins/qualitymonitor,gapro-1&abouttext=StreamCyclone Player&aboutlink=http://www.streamcyclone.com/&gapro.accountid=UA-679067-4&gapro.trackpercentage=true&gapro.tracktime=true" wmode="opaque" allowscriptaccess="always" allowfullscreen="true" quality="high" name="mpl" id="mpl" style="undefined" src="http://manage.streamcyclone.com/player/player.swf" type="application/x-shockwave-flash"></embed>
</html>
I've put this html file in the assets folder as "broad.html" and here is my code:
public class BroadcastingActivity extends Activity {
WebView engine;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
engine = (WebView) findViewById(R.id.web_engine);
engine.getSettings().setJavaScriptEnabled(true);
engine.getSettings().setAllowFileAccess(true);
engine.getSettings().setPluginsEnabled(true);
engine.getSettings().setSupportZoom(false);
engine.getSettings().setAppCacheEnabled(false);
engine.getSettings().setCacheMode(engine.getSettings().LOAD_NO_CACHE);
engine.loadUrl("file:///android_asset/broad.html");
}
}
I've also set the permission for Internet in the manifest file. But when running. nothing works !!
Any help please ?
You require Flash for this video to work, for more solutions you can read here: using flash with android webview
I am trying to show a normal PDF document on an Android device.
And I m pretty comfortable in doing so.
The actual problem which I am facing is,
1. PDF docs are saved in binary format in the Backend
2. When I fetch those from my Android App, I get binary content
3. I want to convert this binary format/content into a format which I can show as PDF document within my Android App
Is their any way to achieve this?
Plz help...
Thanks in advance...
You can try this
public class MyPdfViewActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView mWebView=new WebView(MyPdfViewActivity.this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
setContentView(mWebView);
}
}
As answered Shylendra Madda here