Android assets webview saying web page not available - android

Got this code from a Eudonix news reader tutorial and everything looks fine but still coming up with webpage not available, tried on emulator and device still same thing.
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
webViewHome.getSettings().setJavaScriptEnabled(true);
setWebViewSettings();
webViewHome.addJavascriptInterface(new JavaScriptMenuHandler(this), "menuHandler");
webViewHome.loadUrl("file:///android_asset/home.html");
}
Anyone know what might be wrong?

Related

Asus Memo Pad 10 (ME102A) - It is posible to hide navbar with Android Jelly Bean 4.2.2?

I'm developing an app that needs to be fullscreen. I've tried some coding without any success which makes me wonder if it could be possible. If there is a way, how could I achieve this? If there is not, what could you suggest?
Thanks.
It depends on your target API. With 4.4 or later you might start with
https://developer.android.com/training/system-ui/immersive.html.
Otherwise try:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
...

Should I Use CordovaWebView or AndroidWebView in my android native App?

I am making a few simple applications for android platform using Phonegap. I used to use the Android WebView to display the html files put in the assets directory like this ....
public class MyQuiz extends DroidGap
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
Soon.. I came to know that this can be done using Cordova Web View too. Is there any difference between the two? Like Performance, Look & feel or anything else? Is my approach Right ?
Here are some useful links which will help you out to understand the exact difference between AndroidWebView and CordovaWebView
https://stackoverflow.com/a/11297966/2266525
http://wiki.apache.org/cordova/CordovaWebView
http://docs.phonegap.com/en/2.2.0/guide_cordova-webview_android.md.html

In phone gap html page take too much time to load

Hi I am making application using phone gap in which certain html pages in asset folder of project. and I am using the code below. but it takes too much time in loading.
can any one give proper solution ?
Thanks!
public class JvdActivity extends DroidGap {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
KeyBoard keyboard = new KeyBoard(this, appView);
appView.addJavascriptInterface(keyboard, "KeyBoard");
super.loadUrl("file:///android_asset/www/index.html");
}
}
If their are lots Images inside the HTML page then to load that page Inside the screen It takes Time.
But if it is requirement of your project then you will use progress bar saying Loading.. so that user can wait till the page gets loaded.

How to view unicode khmer on android?

public class WebKhmer2Activity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView mWebView = (WebView) findViewById(R.id.web);
String source = "អ្នកជាមនុស្ស​ មិនមែនសត្វ";
mWebView.loadDataWithBaseURL("null",source,"text/html","UTF-8",null);
}
}//output just like box it should be អ្នកជាមនុស្ស មិនមែនសត្វ
It's getting easier now, but still not out of the box. There is a group on facebook that has a lot of documentation (because the hacks for Khmer Unicode vary depending on your software and hardware). I would recommend joining the facebook group here. And then check out the files they have for documentation on various methods for getting Khmer Unicode to work on Android here.

how to run local web application in android webview

can anybody tell how to run the local webapplication using android webview
I want to run my own webpages in android using web view
Thanks
I'm guessing you want something like this:
private WebView mWebView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourLayoutWithAWebView);
mWebView = (WebView)findViewById(R.id.yourWebViewIdFromTheLayout);
mWebView.getSettings().setJavaScriptEnabled(true); // Enable JavaScript
mWebView.loadData(yourHtmlData, "text/html", "utf-8");
}
Hopefully, that at least points you in the right direction.
Also, I'd recommend reading the documentation on the WebView, it's pretty thorough.
Just run your application on the emulator, as you normally do (and be sure to have your computer connected to internet).

Categories

Resources