Privacy Policy

Kotlin – Hello world

Introduction What is Kotlin? It is a new programming language built by JetBrains, and as you may already know, Google announced at Google I/O 2017, that they will now officially support this language. It is inspired by existing languages such as Java, C#, JavaScript, Scala and Groovy. What are the advantages of using Kotlin? it’s […]

,
Snippets, Solutions

How to get current flavor from gradle

 Figuring out how to pull the current flavor from gradle While working on an update for one of our games, I needed to figure out how to get the current flavor and use it in code. Since there are a lot of ways to do this, I chose to create a custom build config parameter and

, , ,
Did You Know?, Solutions

Signing key SHA1 fingerprints within AndroidStudio

Did you know you can get the signing SHA1 and MD5 fingerprints within AndroidStudio? Ever needed the SHA1, SHA-256 or MD5 fingerprints of your Android debug/release key/certificate? Maybe for a new API or framework that you want to integrate in your project like Firebase, Facebook or Maps? See that you can also get it from AndroidStudio, pretty

, , , , , ,
Snippets

Generate random number between 2 numbers

The following snippet will help you generate a random number in Java that is between 2 numbers (min and max). static Random random = new Random(); /** * Min is inclusive and max is exclusive in this case **/ public static int randomBetween(int min, int max) { return random.nextInt(max – min) + min; } Please

, ,
Tutorial

Android Navigation View With Tabs

In this tutorial we will create a simple app which has a NavigationView, a Toolbar with Tabs and a simple list of items, that are displayed for each selected tab. Tools used: Android Studio 2.2 Preview 4 Android Emulator 5x API 22 Project Create a new project by choosing the empty template and then click

, , , , , , ,
Solutions

Android: CoordinatorLayout RecyclerView First Item not visible

Problem I had to implement a Toolbar with tabs, together with CoordinatorLayout, and the content of each tab had to be a list of items, for which I used RecyclerView. But when I ran the app, the first item in the list was overlapped by the tabs, so it was not fully visible. This is how my xml

, , , , ,
Solutions

Android Studio can’t open Android Device Monitor

Problem Recently I had this issue: my Android Device Monitor didn’t open and and an error log file was generated every time I was tring to open it, under Android – sdk – tools – lib – monitor-x86_64 – configuration. Also, I have to mention that it happened on Windows. I googled it and found different answers but none

,
Tutorial

Android AdMob With Firebase

About Firebase First of all, you have to know that using AdMob with Firebase is optional, at least for now, and you can still integrate AdMob by importing compile ‘com.google.android.gms:play-services’ (like in this tutorial). But even if it is optional, it is recommended, as it brings all services like AdMob, Analytics, crash reporting and other services together in just

, , ,
Solutions

Android Gradle Dependencies by Flavors

In a previous post about Gradle Flavors and Build Types, we mentioned that we can set different dependencies inside dependencies{} block by flavors, by build type or both combined. Below we will see an example for each situation. By flavors <flavorName>Compile apply plugin: ‘com.android.application’ android { compileSdkVersion 23 buildToolsVersion “23.0.3” defaultConfig { applicationId “com.example.diana.buildvariants” minSdkVersion 15 targetSdkVersion

, , , , , ,
Did You Know?

Android About ConstraintLayout

DID YOU KNOW about ConstraintLayout?   Definition ConstraintLayout is a new type of layout introduced by Android, similar to RelativeLayout but more flexible, and it is used to position UI elements relative to other UI elements by using constraints. A constraint represent the rules we have to apply in order to position our UI elements relative to

, , , , , ,
Tutorial

Android Free/Paid Versions Tutorial

There are situations when you might decide that you need to create 2 versions for your application: a free one and a paid one. So, in this tutorial, which is just a simple example (we will just set different colors for the 2 versions), we will see how to achieve this using flavors. Your project is

, , , , ,
Did You Know?

Android ApplicationId vs PackageName

You might wonder what is the difference between package name we have in AndroidManifest.xml file and ApplicationId we see in build.gradle. They seem to be the same thing, but actually they are 2 different things. So if you didn’t know what is the difference between these 2 properties, you can find out now. ApplicationId represents

, , , ,
Tutorial

Android Build Types and Flavors

In this tutorial we will talk about Build Types and Flavors, for what are they used, what is the difference between them and what they have in common. Build Types When you work on a project, at some point you might need to run your app in release mode, or debug mode, or qa mode, or any other mode you

, , , ,
Snippets

Get screen size programatically in Android

So if you ever need to get the screen size(width and height) programatically on Android, note that there are a few options out there. Please see below some of them. Get Android screen size from DisplayMetrics The following snippet helps you load the screen size in Android using the Display class. This is quite old,

, , , , , ,
Scroll to Top