Questions tagged [android]

Android is Google's mobile operating system, used for programming or developing digital devices (Smartphones, Tablets, Automobiles, TVs, Wear, Glass, IoT). For topics related to Android, use Android-specific tags such as android-intent, android-activity, android-adapter, etc. For questions other than development or programming but related to the Android framework, use this link: https://android.stackexchange.com.

Android is a mobile operating system developed by a consortium of developers known as the Open Handset Alliance, with the main contributor and commercial marketer being Google. It is based on a modified version of the Linux kernel and other open source software and is designed primarily for touchscreen mobile devices such as smartphones and tablets. In addition, Google has further developed Android TV for televisions, Android Auto for cars, and Wear OS for wrist watches, each with a specialized user interface. Variants of Android are also used on game consoles, digital cameras, PCs, and other electronics.

Tag Usage

When asking about your app force closing or crashing, you have to include an MCVE, which has to include a stacktrace. See also: How to Ask

When adding additional tags to questions, please use the Android-specific tags such as , , , and not individual tags like , or .

For non-developer Android questions, see Android Enthusiasts Stack Exchange.

Manufacturer-Monitored Tags

These tags are used for developer assistance by Android device manufacturers for their specific devices:

ISV-Monitored Tags

These tags are meant for libraries, services, etc. for Android that are monitored by their respective developers:

( (now deprecated))

Resources

Android Versions

Official API Documentation

Applications

Source Code and Building

Developers

Playlist of videos for Google I/O.

  • Android Tools Project Site
    On this site, you will find information about the Developer Tools for Android (Dalvik Debug Monitor Server (DDMS), hierarchy viewer, lint) and various tips & how-to documents.

In addition, there are other Android developer support sites, operating in other languages.

For non-developer questions, see the Android Enthusiasts Stack Exchange site.

Android Programming Books

Android Loggers

  • logger - Simple, pretty and powerful logger for android
  • timber - A logger with a small, extensible API that provides utility on top of Android's normal Log class.
  • LoggingInterceptor - An OkHttp interceptor which pretty logs request and response data.
  • Bugfender - Upload your logs and check them online, specially made for mobile
  • EzyLogger - Simple Lightweight logger
  • Logback Android - Logback port to Android which provides a highly configurable logging framework for Android apps.

Chat Rooms

Chat about Android with other Stack Overflow users:

Stack Exchange

IRC:

Development IDEs

Tutorials & Examples

Online Courses

Online Specialization Verified Courses

Sites that list Android libraries

Open-sourced Android apps

Samples

Podcasts for Android

Weekly

Frequently Asked Questions

1409497 questions
804
votes
29 answers

Can I underline text in an Android layout?

How can I define underlined text in an Android layout xml file?
Janusz
  • 187,060
  • 113
  • 301
  • 369
785
votes
14 answers

getColor(int id) deprecated on Android 6.0 Marshmallow (API 23)

The Resources.getColor(int id) method has been deprecated. @ColorInt @Deprecated public int getColor(@ColorRes int id) throws NotFoundException { return getColor(id, null); } What should I do?
araks
  • 40,738
  • 8
  • 34
  • 39
783
votes
101 answers

"cannot resolve symbol R" in Android Studio

In every instance in all of my classes where I reference R.id.something, the R is in red and it says "cannot resolve symbol R". Also every time there is R.layout.something it is underlined in red and says "cannot resolve method setContentView(?)".…
ez4nick
  • 9,756
  • 12
  • 37
  • 69
781
votes
16 answers

Best practice for instantiating a new Android Fragment

I have seen two general practices to instantiate a new Fragment in an application: Fragment newFragment = new MyFragment(); and Fragment newFragment = MyFragment.newInstance(); The second option makes use of a static method newInstance() and…
Graham Smith
  • 25,627
  • 10
  • 46
  • 69
775
votes
37 answers

Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

When trying to run the Example CorDapp (GitHub CorDapp) via IntelliJ, I receive the following error: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How can I modify the IntelliJ settings so…
Joel
  • 22,762
  • 5
  • 26
  • 41
773
votes
17 answers

How to decompile DEX into Java source code?

How can one decompile Android DEX (VM bytecode) files into corresponding Java source code?
Will
  • 73,905
  • 40
  • 169
  • 246
766
votes
30 answers

How do I obtain crash-data from my Android application?

How can I get crash data (stack traces at least) from my Android application? At least when working on my own device being retrieved by cable, but ideally from any instance of my application running on the wild so that I can improve it and make it…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
765
votes
22 answers

How do I get the current GPS location programmatically in Android?

I need to get my current location using GPS programmatically. How can i achieve it?
mudit
  • 25,306
  • 32
  • 90
  • 132
751
votes
20 answers

Standard Android Button with a different color

I'd like to change the color of a standard Android button slightly in order to better match a client's branding. The best way I've found to do this so far is to change the Button's drawable to the drawable located in…
emmby
  • 99,783
  • 65
  • 191
  • 249
745
votes
15 answers

How to use ADB Shell when Multiple Devices are connected? Fails with "error: more than one device and emulator"

$ adb --help -s SERIAL use device with given serial (overrides $ANDROID_SERIAL) $ adb devices List of devices attached emulator-5554 device 7f1c864e device $ adb shell -s 7f1c864e error: more than one device and emulator
Jackie
  • 21,969
  • 32
  • 147
  • 289
744
votes
6 answers

Detect whether there is an Internet connection available on Android

Possible Duplicate: How to check internet access on Android? InetAddress never timeouts I need to detect whether the Android device is connected to the Internet. The NetworkInfo class provides a non-static method isAvailable() that sounds…
Dan
  • 15,948
  • 20
  • 63
  • 92
738
votes
31 answers

Using context in a fragment

How can I get the context in a fragment? I need to use my database whose constructor takes in the context, but getApplicationContext() and FragmentClass.this don't work so what can I do? Database constructor public Database(Context ctx) { …
tyczj
  • 71,600
  • 54
  • 194
  • 296
725
votes
12 answers

Get root view from current activity

I know how to get the root view with View.getRootView(). I am also able to get the view from a button's onClick event where the argument is a View. But how can I get the view in an activity?
Lalith
  • 19,396
  • 17
  • 44
  • 54
725
votes
10 answers

How can I avoid concurrency problems when using SQLite on Android?

What would be considered the best practices when executing queries on an SQLite database within an Android app? Is it safe to run inserts, deletes and select queries from an AsyncTask's doInBackground? Or should I use the UI Thread? I suppose that…
Vidar Vestnes
  • 42,644
  • 28
  • 86
  • 100
719
votes
13 answers

What is the difference between compileSdkVersion and targetSdkVersion?

I have looked at the documentation for building with Gradle, but I'm still not sure what the difference between compileSdkVersion and targetSdkVersion is. All it says is: The `compileSdkVersion` property specifies the compilation target. Well, what…
coder123
  • 9,267
  • 5
  • 16
  • 13