Android: Basic WebView Tutorial

A WebView lets you pull a web page and display it in your Android app. It doesn’t take long to implement an Android WebView. Read on. I’ll show you how. AndroidManifest.xml First, open your manifest file to add this permission for INTERNET:

The web page won’t be loaded into your app without this permission. […]

Read More

PHP: get full URL of current page with GET params or without

The following string variable’s value will get the full URL of the current page, including GET arguments/params, if present.

To get the full URL of current page but WITHOUT the GET args/params, do this instead:

The strtok function will return only the part of the URL string up to the character before question […]

Read More

PHP: avoid backslash on json_encode

Hey! 🙂 If you are encoding your Arrays to JSON in PHP using json_encode() and the function adds backslash before your slashes, I’m gonna show you a quick fix. This is my original code:

And the result is: {“success”:true,”message”:”Please enter email\/phone number.”} See the added backslash before the slash? Ugly, right? To avoid that, […]

Read More

Android NetworkOnMainThreadException at StrictMode fix (with deprecated methods used)

A JSON Parser developed by some members of the Android dev team. But a few weeks after completion of the parser, several methods became deprecated. And when we use that parser, we get errors. Part of the stack trace is as follows:

Not sure if the NetworkOnMainThreadException is being thrown because of the deprecated […]

Read More

Android/Java: get variable data type

For some reason you might need to get the data type of your Java variable. Here’s an example of what you can try:

Then do whatever you like with data_type, whose value should be “String”. 🙂

Read More

Get device’s IMEI in Android app development

Here’s the content of my MainActivity class where I log the IMEI of my test device.

You also need to add this permission to your AndroidManifest.xml file:

Place it inside the <manifest></manifest> tag, but same level as <application></application>. Source: How to get the device’s IMEI/ESN programmatically in android?

Read More

Android: open web page in a browser

To open a web page in an Android app, we need to create a new Intent and start a new Activity with it. Here’s a Java method that we can re-use:

Just pass the URL of the web page you’d like to open to this method. Source: How to open a website when a […]

Read More

Laravel 5: How to change Auth URL from “/auth/login” to just “login”:

Just sharing a link telling us how to remove the “auth” in the URL for Laravel’s pre-made login system. You need to modify App\Http\Middleware\Authenticate::handle() method and change auth/login to /login. Then you need to add $loginPath property to your \App\Http\Controllers\Auth\AuthController class. Source: How to change default redirect URL of Laravel 5 Auth filter?

Read More