Skip to main content
Collection

Android Frequently Asked Questions

The Android-related questions that get asked repeatedly, gathered together in one place. What does a new developer always ask at some point? What are the most common questions when someone is exploring a new facet of mobile development? Add the best questions and answers to this collection. This collection also serves as a repository for excellent Q&As for curators to propose as duplicate targets for commonly asked questions.

Created
Active
Last edited
Viewed 5k times
Part of Mobile Development Collective
17
6391 votes
34 answers
1.5m views

What is the difference between px, dip, dp, and sp?

Answer Accepted

From the Android Developer Documentation: px Pixels - corresponds to actual pixels on the screen. in Inches - based on the physical size of the screen. 1 Inch OR 2.54 centimeters mm > ...

View answer
Alex Volovoy's user avatar
Common question
Berthold's user avatar
1490 votes
29 answers
1.5m views

Is there a way to get the source code from an APK file?

Answer Accepted

Simplest way: use the online tool Decompiler, upload the apk, and get the source code. Procedure for decoding .apk files, step-by-step method: Step 1: Make a new folder and copy over the .apk file ...

View answer
Prankul Garg's user avatar
Very common need
Berthold's user avatar
4352 votes
130 answers
1.9m views

How can I close/hide the Android soft keyboard programmatically?

Common question with multiple highly-upvoted answers
Berthold's user avatar
1300 votes
44 answers
1.8m views

How to get current time and date in Android

Common and basic need
nope's user avatar
2 votes
3 answers
3k views

No Activity found to handle intent OPEN_DOCUMENT_TREE on some Samsung Android devices

This is a major issue as starting from android 11 we can not directly access the usb storage without SAF Framework so is we can not handle this then it will be troublesome
Ayush Sharma's user avatar
70 votes
15 answers
93k views

How to make EditText not focused when creating Activity

Answer Accepted

You can set property of Layout like android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true" Example: <RelativeLayout xmlns:android="http://schemas.android.com/...

View answer
Pratik Butani's user avatar
Common question for newbie
Pratik Butani's user avatar
190 votes
25 answers
152k views

INSTALL_FAILED_DUPLICATE_PERMISSION... C2D_MESSAGE

Answer

I've found a solution that works for me. In My Device (Nexus 7) Android 5.0. Lollipop I follow these steps. After Uninstalling App You will find App Name under Apps List of the Downloaded tab. Go ...

View answer
Pratik Butani's user avatar
Common question when you are using Tablet or newer device for testing
Pratik Butani's user avatar
2258 votes
32 answers
821k views

What is 'Context' on Android?

Common question of newbie
user2357113's user avatar
29 votes
3 answers
52k views

How can I create a multilingual android application?

Many people either do not know or adapt wrong way to add multi lingual feature to the app.
Ayush Sharma's user avatar
60 votes
8 answers
112k views

How to add Firebase custom events for analytics?

many developers are asking for firebase custom events for the firebase analytics.
Pratik PSB's user avatar
1299 votes
50 answers
700k views

Activity has leaked window that was originally added

Multiple active answers for Most common issue while working with various dialog and not aware about host activity lifecycle.
Harshali's user avatar
34 votes
5 answers
21k views

JDBC vs Web Service for Android

New developers to mobile trying to connect to backend database should understand difficulty/trade-offs
Morrison Chang's user avatar
1 vote
2 answers
151 views

How can i check if my string resource has a placeholder? Kotlin

For developers while trying to update or replace placeholders with values in a list of string resources(R.string....), this can help them check for string resources with placeholders in the list
Oyindamola Gideon Olarewaju's user avatar
23 votes
4 answers
5k views

Where are the file templates in Android Studio 4.1 located?

Answer

For android studio 4.1 I found the live templates XML in this below path: IDE configuration directory changes The locations of user configuration directories have been changed to the following: ...

View answer
Adarsh Sahu's user avatar
During Google I/O, devs use these shortcuts to demo prewritten codes in very short time without doing mistakes.
Adarsh Sahu's user avatar
110 votes
4 answers
26k views

What exactly is "label" parameter in ClipData in Android?

The parameter name is confusing, and used mainly for developer reference to describe data.
Gaurav's user avatar
5 votes
3 answers
4k views

UnsatisfiedLinkError in native method

New developers get this while working with JNI library
Maveňツ's user avatar
3172 votes
54 answers
831k views

How to stop EditText from gaining focus when an activity starts in Android?

Very common problem of newbie
Maveňツ's user avatar
3095 votes
54 answers
1.3m views

Is there a unique Android device ID?

very common problem while starting android development
Maveňツ's user avatar
2735 votes
65 answers
1.5m views

How can I fix 'android.os.NetworkOnMainThreadException'?

Common problem of newbie
Maveňツ's user avatar
1968 votes
44 answers
1.2m views

How to get screen dimensions as pixels in Android

UX problem while programmatically designing layout
Maveňツ's user avatar
1727 votes
39 answers
1.5m views

Android 8: Cleartext HTTP traffic not permitted

problem while doing network operations
Maveňツ's user avatar
1537 votes
53 answers
1.3m views

How do I pass data between Activities in Android application?

frequent issue while working with data exchange between activities.
Maveňツ's user avatar
1473 votes
17 answers
299k views

What is the difference between match_parent and fill_parent?

Both are defined as constant -1 in google docs
Maveňツ's user avatar
1389 votes
44 answers
652k views

Strange OutOfMemory issue while loading an image to a Bitmap object

developers face problem while handing bitmaps
Maveňツ's user avatar
1242 votes
45 answers
450k views

Android SDK installation doesn't find JDK

Common problem of newbie while installing android studio
Maveňツ's user avatar
1222 votes
30 answers
1.0m views

Can't create handler inside thread that has not called Looper.prepare()

Issue while doing ui related stuffs in worker thread
Maveňツ's user avatar
0 votes
0 answers
35 views

Adding ExoPlayer video to Recycler View's 0th position gives flickering

Trying to add a video to the previous or 0th position gives flickering
Rakshit Nawani's user avatar
0