Category: Android Code

January 3, 2017

How to Hide and Show Soft Keyboard in Android

There may be a case where you want to hide or show the soft keyboard. The case may be for example, you are done with entering text in search view and based on your selection from the suggestion list you want to take some action and also want to close (hide) the soft keyboard. You can hide or show the soft keyboard programmatically in Android […]

December 26, 2016

How to Get Width and Height of Android Screen in Pixels

Sometimes you want to know the screen width and height in pixels. An example can be that you are developing a system information app and you have to display screen width and height in your activity. This is going to be so simple with very few lines of code. The following code snippet give you the screen width and height in pixels. Display display = […]

December 25, 2016

Android How to Check Service is Running or Not

In some cases you might want to check that a service is running or not. An example user case would be, in your app there is a service that sync data to server and you have given user the possibility to toggle the related service on and off. So how do you know that the service is currently running or not? To Know service running […]