Posts

Display a table in JFrame UI from MySQL Table

Introduction :    Many times while creating UI you come across difficulties like, how to display data to the user which is readable and looks good. Mostly labels are used to display text but for dynamic data, there's no good way to show them. So, here is the way to display data in a table directly from the MySQL table on the UI using JTable and some tricks to read data from ResulSet object, the output from the MySQL database. Implementation : The following code should be added in the frame initialization methods. Explanation : Firstly creating the data structures to store the data values and the column names. Looping through the ResultSet object and reading the data. Looping through the ResultSetMetaData object, which returns the names of the table which we will use as column names. Adding the JTable to JScrollPane, to make the Table scrollable. Source : I have a project on GitHub that implements such codes. It is a project of the Library Manag...

What are Google Play Instant Apps

Native Android apps, without the installation With Google Play Instant, people can tap to try an app or game without installing it first. Increase engagement with your Android app and gain more installs by surfacing your instant app across the Play Store, Google Search, social networks, and anywhere you share a link. Android’s new app publishing format, the Android App Bundle, makes it easier than ever to offer a Google Play Instant experience. Starting from the Android Studio 3.3 beta release, you can build and publish one app bundle artifact to Google Play containing both instant and dynamic feature modules. Build instant games easily with Cocos and Unity plug-ins. Google Play Instant is open to all app and game developers. These apps will give the experience to use it and test it on the device without the need to download the whole app. This method is suitable with games because the user first wants to know whet...

Vibrate Android device programmatically

Android has inbuilt functions to make a device vibrate. You can specify a time for which the device vibrate and also check if the device can vibrate itself and other inbuilt services.

Notify the user, when the user goes in wrong direction (Google Directions API)

If you are using Google's Direction API, it easy fairly easy to determine whether a user is following the route or not. If the user fails to follow the path, the user can be notified and given the right instructions to remain on the path. Most of the time, the user gets a new route, i.e. the route changes. It can be implemented as below.

Toggle Bluetooth from Command Line on Mac OS

There will be situations where you can't access the touchpad or just want to show off your command line skills 😋, then this commands will change your Bluetooth handling skill It'll be clearly handy to use it. Finding new ways led me to this blueutil  command line tool that helps to turn Bluetooth off/on using single cmd. Start by installing it by HomeBrew: run the following command The -p flag act as a switch to toggle the Bluetooth Tell me when you found this command helpful.

Monetise your Android app | Admob integration | with code...

Making an Android app is one thing but earning from it is other. There are many ways to earn from apps like premium packs, subscription, buying stuff, ads.  The advertisement would be the most efficient one and will give you good revenue. There are many advertising networks but Google provides AdMob which is more preferable in terms of standard and revenue too. Also, read:  Converting HTML5 Game for Android | 2 Methods So let us start to code. I'll explain two types of ads only if you want me to explain the other two, comment for the same. Steps to integrate AdMob into your Android app: 1. Creating an Admob account Go to AdMob site sign in with your Google account. Create an app and note down the App Id, which we'll use in our app to authenticate. 2. Import Mobile Ads' SDK Open your gradle files and in your project-level gradle, put the below code, inside  allprojects {}  section. 3. Add Dependencies Add the following in your...

Converting HTML5 Game for Android | 2 Methods

HTML5 games are easy to develop and use. It has great graphics and processing capabilities. Many may wonder to convert their web apps compatible with Android. So here are two methods, which will walk you through Android development for making your web app compatible with your favorite platform. Method 1: Hosting the Game  There are various sites where you can host your HTML game for free and also earn from it. After hosting it take the link of the Game use it to make your Android game. 1. Create a new Android Project (obviously) 2. Add the following to the '.XML' file of the layout. In the above snippet, a WebView is created which takes up the whole screen. And a ProgressBar which is by default round and will appear when the page is loading. Till now there won't be any errors 😅 3. In your MainActivity.java, start by typecasting the WebView and ProgressBar. 4. Add web settings and enable JavaScript. The above code creates some basic Web Se...