Recent Posts
Find your way around MySQL console (command line)
Using graphic tools to interact with database is very easy but in many cases you might find yourself in a situation that you don’t have way other than a simple CLI for example because you are connecting to the server via SSH. That’s why it is useful to know the basic commands to at least find your way around and get the job done.
Connecting to database server:
To specify which host or database we are connecting to and what username and password we are using:
read more
Fixing BadTokenException in Android WebView
So you have successfully created a webView in your App and already loaded your URL into it.
<pre class="lang:java decode:true "> WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.setWebViewClient(new MyWebViewClient()); myWebView.loadUrl(url); However, any interaction with the page (such as a dropdown menu) will result in BadTokenException crash with the following error message;
FATAL EXCEPTION: main
android.view.WindowManager$BadTokenException: Unable to add window — token is not valid; is your activity running?
This happens when app wants to open a new dialog (e.
read more
Showing static HTML in WebView - Android
Loading a live web page from the internet into Webview object is straight forward.
The simplest way is to create a Webview object and load URL into the object:
<pre class="lang:java decode:true ">webview.loadUrl("http://your-website.com/"); But what if you need to show a custom HTML page to your users?
For a simple static page you can create a HTML document in a string variable and load it into Webview object:
<pre class="lang:java decode:true ">String welcome = "Welcome <em>John</em>!
read more