I am trying to show
http://www.google.co.jp/m/place#ipd:mode=home
website thru WebView in Android emulator but I am not seeing the web
site and seeing only blank space under the place tag of the page.
I am able to see other sites like www.google.com.
Do I need to enable more settings for the google place page?
Permission in the manifest
<uses-permission android:name="android.permission.INTERNET" />
Code
WebView view= (WebView) findViewById(R.id.view1);
View.getSettings().setJavaScriptEnabled(true);
View.getSettings().setBuiltInZoomControls(true);
View.getSettings().setSupportZoom(true);
View.loadUrl(" http://www.google.co.jp/m/place#ipd:mode=home");
You need to do
view.getSettings().setAppCacheEnabled(true);
view.getSettings().setDomStorageEnabled(true);
on the setting object. That fixed the problem for me.
Related
I am developing an Android application which uses WebView, and I would like to open a link in the app. The problem I have come across is that each of our customers use a different URL and is set via a preference in the android application. From, what I understand you have to set a link in the android manifest. Is this still achievable to have a link open in the application?
In order to open a link in the app just make sure to have an Activity that has a WebView on its layout. Then, in your activity do something like this:
WebView webview = (WebView) findViewById(R.id.your_web_view);
webview.loadUrl("http://your.url/");
Just read the user preference that stores the URL before calling loadUrl() and you're all set
You need to add a webview and give it an id. And then do this in your code:
//Identify the webview
WebView web_view = (WebView)findViewById(R.id.web_view);
//start web client
web_view.setWebViewClient(new WebViewClient());
//Load URL
web_view.loadUrl("your url");
And don't forget to add this line in your AndroidManifest.xml file :
<uses-permission android:name="android.permission.INTERNET" />
Hope it works!! :)
I am writing an Android App for a charity, and would like to be able to display the charity's facebook feed within the App. I don't want it to go through the phone's web browser, nor the facebook app.
I read on the developers.facebook.com how to add facebook's android sdk to the app's build gradle. But what I can't find is code for a simple android activity that will display the facebook timeline. I don't have time to dive deep into facebook's sdk to fiigure it out. And the last thing I want to do is reinvent the wheel.
Can anyone point me towards some code for a simple activity to display a facebook timeline? Any help will be greatly appreciated.
I'm not home so I can't test this right now but it should work.
In your layout file, put a webview like so:
<WebView
android:id="#+id/mWebView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Then in the onCreate method:
WebView mWebView = (WebView) findViewById(R.id.mWebView);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://LinkToFacebookPage.com/");
And finally, in your manifest file put the following permission before < Application >
<uses-permission android:name="android.permission.INTERNET" />
I realized that not working for under android 4.3 versions.
I have an android app which has webview. When i try to load url "http://instagram.com" it's not working It shows blank page but facebook webpage is working.
It's really important for me please help.
WebView view = (WebView) findViewById(R.id.webView1);
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl("http://www.instagram.com");
Have you tried using the method:
setDomStorageEnabled();
Sets whether the DOM storage API is enabled. The default value is
false.
for example:
WebView view = (WebView) findViewById(R.id.webView1);
view.getSettings().setJavaScriptEnabled(true);
view.getSettings().setDomStorageEnabled(true);
view.loadUrl("http://www.instagram.com");
I had previously problems loading Facebook and Twitter pages in some devices, solved using setDomStorageEnabled() method.
In my application on click of a button i am trying to launch the following url using a web view :
https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore
My code is as below:
WebView webView=new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.loadUrl("https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore");
When the web view appears it first displays the following:
And immediately displays the following:
I do not get to see the maps. Am i missing on something in my code. Can someone kindly help me with this please. Thanks in advance.
I had the same issue in using Google Maps URL into a ColorBox popup.
I found out that you can add &output=embed at the end of the URL to make it show in an iframe.
Maybe this solution will help you too.
So try:
webView.loadUrl("https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore&output=embed");
i found that WebView does not support javascript by default, and this will lead google map jump to a URL that contains a params "nojs",
so, just add this line for your webview, problem gone.
webview.getSettings().setJavaScriptEnabled(true);
I am facing a problem to set the side of webpage loaded in android webview.
problem is when i load the login page of the website it gets fitted absolutely well in the webview but wen i click on the hyperlink for new signup then the next page(registration page) loads with 100% scale in the browser and shows horizontal and vertical scroll bars.
i want to fit this registration page according to device width.
how to do this please help me
tried almost all option available in stackoverflow n google
Also tell me how to access the SQL database(save and retrieve information from database) on android device which is operating the website
The code i used is :
Java file :
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
String usrUrl = "http://" + txturl.getText().toString();
mWebView.setInitialScale(30);
//mWebView.setMinimumHeight(70);
//mWebView.setMinimumWidth(30);
mWebView.getSettings().setSupportMultipleWindows(true);
mWebView.getSettings().setUseWideViewPort(true);
//mWebView.setWebViewClient(mWebView.set)
//mWebView.setWebViewClient(clbk.shouldOverrideUrlLoading(mWebView, usrUrl));
//mWebView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
mWebView.loadUrl(usrUrl);
In Manifest file :
<meta name="viewport" content="target-densitydpi=device-dpi, width=240px" />
You could do something like this
webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
EDIT
You'll then need:
webview.getSettings().setBuiltInZoomControls(true);
to alter the zoom afterwards