Tag: webview

Android – show/hide fragment leaves an empty area

Given: Two vertically placed elements on the screen (ViewPager and Fragment) Action in the first currently selected fragment (ViewFlipper) toggles between text-based and WebView-based view in the top fragment and hides/shows bottom fragment. Observed: Hiding the bottom fragment leaves an empty space where the bottom fragment is located. I tried both Relative and LinearLayout (with […]

Custom font for webview

I am trying to establish a new custom font (otf file) for my web view. I put anbaaarabic_bold.otf in assets file. There is how i do: String head = “<head><style>@font-face {font-family: ‘verdana’;src: url(‘file://”+ getActivity().getFilesDir().getAbsolutePath()+ “/anbaaarabic_bold.otf’);}body {font-family: ‘verdana’;}</style></head>”; String htmlData= “<html>”+head+”<body style=\”font-family: verdana\”>”+body+”</body></html>” ; mBodyArticle.loadDataWithBaseURL(“http://nada”, htmlData, “text/html”, “utf-8”, “”); body : contain my html code. I […]

How a change the content size of a webview in android?

I have a webview control in a scrollview. when i load a long html document into it, it resizes to accommodate it. this is correct. however, when i use the same control again afterwards and put less space-consuming html into it, the content size doesn’t shrink. this is a problem because the user is able […]

Open html file located inside my application using WebView

I am just started Android application development. Here i have a simple Activity which contains a WebView. It works fine when i try to open a website (like http://www.google.com). But i want to open a html file (assume index.html) file which i created in my application’s ‘res’ directory. Full path is ‘res/base/index.html’. Then how to […]

How can load https url without use of ssl in android webview

I have Marked one problem on Playstore and google send the mail my app is unsafe because use of SSL. Currently in my application I have one webview which is load link and it contains https url. on web settings I’m doing like this: web.setWebViewClient(new SSLTolerentWebViewClient()); to ignore ssl certificate I use following code but […]

Open Url in webView in android

How to open this link in webView. This is running on browser but it does not run in webView android. Please give solution.

Android WebView blocks redirect from https to http

I have a solution where my Android WebView needs to first open a https url, then it will be redirected to a http url (it might be trying a http POST from the https site). This is not working, and my Android debug log says: 02-20 11:04:45.079 8538-8538/? E/WebViewCallback´╣Ľ Blocked URL: [blocked] The page at […]

android – how to prevent webview to load when no internet connection

I have an Android app which has a webview. When there’s no internet connection, webview will display page not available. I want to make this look like an app as much as possible, so I don’t want to display this page. I found some useful info online teaching you how to hide or load something […]

how to set margin in Dialog

I have used Dialog for display ad in my Andorid app.But I have to display this Dialog about 50dp top from buttom so i think we should set Dialog Gravity buttom and set its buttom margine 50dp.But i’m unable to use margin in Dialog.so please can suggest me how to solve this. XML: <?xml version=”1.0″ […]

Justify text in an Android app using a WebView but presenting a TextView-like interface?

I’m looking for a simple way to forget that I’m using a WebView to have justified text in my TextView. Has someone made a custom view for this? I’m well aware that I can do something like this: WebView view = new WebView(this); view.loadData(“my html with text justification”,”text/html”,”utf-8″); But it gets ugly when you want […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.