Solutions

Solutions for different problems, might not contain code

Articles, Solutions

Load instrumentation test local files

Sometimes you might need to add setup files (json/xml/.properties/etc.) to your instrumentation tests (androidTest) and load them in your tests. You usually do that when loading for example some mocked data set or some fixture. In testing, fixtures often take the form of JSON or yaml files that mimic the responses from real API calls. […]

, , ,
Articles, Solutions

Print Android instrumentation tests logs in the terminal/console

While debugging some Android instrumentation tests that were ran using adb shell am instrument, I needed to print some logs into the terminal/console to inspect the flow and resolve some issues. Ever been coding away, trying to track down what’s happening under the hood, thinking Log.i/e/d or System.out would be your trusty sidekicks for logging

, , , ,
Solutions

Android Squared CardView

Recently, I had to add a perfect squared CardView and I wanted to achieve this without hardcoding its width and height. I happily discovered the power of ConstraintLayout. And so this is how I managed to create a perfect square which should work on every dimension. Heres some sample code that I used to create

, , ,
Snippets, Solutions

Android Show HTML Bulleted List from strings.xml

If you search on the internet about how to show a bulleted list from strings.xml using HTML tags, most of the answers will say that you should use a WebView, or to use the bullet symbol directly, or other alternatives. And on some posts I even read that you can’t use <li> tag from HTML

, ,
Articles, Solutions

Android – HTML in textView

Display HTML format First we will present below what are the supported tags for a textView and what are not supported. You can skip this section if you are already familiar with these or you want to jump directly into action :) Supported tags Unsupported tags <a href=”…”> <b> <big> <blockquote> <br> <cite> <del> <dfn>

, , , , , , , , , ,
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

, , , , , ,
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

,
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

, , , , , ,
Solutions

Error:Execution failed for task ‘:Application:transformClassesWithDexFor

Error:Execution failed for task ‘:Application:transformClassesWithDexForMyFlavorName’. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java” finished with non-zero exit value 2 I had this error after updating the project to the latest Build Tools 23.0.0. After spending some hours on google to find a solution without any success, I tried to deactivate the Instant Run option from Preferences.

, ,
Solutions, Tutorial

Android Set Horizontal Divider to a Vertical LinearLayout

If you need to use a “list” divider, but you need it on a vertical LinearLayout instead of a List you can do this by using some attributes on the LinearLayout. It’s not very straightforward as you maybe expected, but it’s not very difficult either. Before starting, you have to know the 2 major things this

, , , ,
Scroll to Top