Android


About device name, current version code, and much more

device name current version code

Hey. There are few tips for regular uses during Android app development. Mostly app required device name, current version code, screen layout size, and much more things. These tricks and tips are mostly used by developers.

So, Without wasting any time let’s get knowledge about these amazing things for every developer.

How to get Device Name?

In my word device name of the, any device is manufacturer and model.

The output of this code

How to get the current Version Code?

Best practice for getting the current app version code by using get package manager in context. Simply create a method for that and pass context to get the current version code.

The output of this code:

How to get Screen Layout size?

Screen Layout size is also an important part of the app developer. Now I am going to show how you can get the screen layout size. We can get this by using given below method.

Let’s take an example:

The output of this code:

In my case, my screen size is normal.

How to get the screen size?

Let’s take an example to get screen size in width*height:

The output of this code:

How to get how much DPI in the screen?

DPI, DPI stands for (dots per inch) is a number that measures how many pixels are contained either across or down in a single inch of screen space.

Let’s take an example to get dots per inch on the screen by using context.

The output of this code:

How to hide the virtual keyboard?

Sometimes an app requires to hide the keyboard forcefully, then we can use this code to hide your app virtual keyboard. Now create this method and simply call it, bypassing your context and view where you want to hide the virtual keyboard.

Conclusion

In this tutorial, I have to discuss some basics but important point line device name, current version code, screen layout size, and many more things. I hope you like it.

Published by Amit Pandey

Professional Android app Developer, Full Stack Web Developer, Blogger, Entrepreneur And Founder of Coding Issue. I am always trying to learn new things or new possible ways to do things.

Did you find this page helpful?

X

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

*