Questions tagged [kotlin]
Kotlin is a cross-platform, statically typed, general-purpose high-level programming language with type inference. This tag is often used alongside additional tags for the different targets (JVM, JavaScript, native, etc.) and libraries/frameworks (Android, Spring, etc.) used by Kotlin developers, if the question relates specifically to those topics.
kotlin
6,271
questions
885
votes
23
answers
559k
views
Unfortunately MyApp has stopped. How can I solve this?
I am developing an application, and everytime I run it, I get the message:
Unfortunately, MyApp has stopped.
What can I do to solve this?
About this question - obviously inspired by What is a ...
31
votes
4
answers
10k
views
Why does my function that calls an API or launches a coroutine return an empty or null value?
(Disclaimer: There are a ton of questions which arise from people asking about data being null/incorrect when using asynchronous operations through requests such as facebook,firebase, etc. My ...
572
votes
19
answers
560k
views
How to launch an Activity from another Application in Android
I want to launch an installed package from my Android application. I assume that it is possible using intents, but I didn't find a way of doing it. Is there a link, where to find the information?
397
votes
10
answers
377k
views
Alarm Manager Example
I want to implement a schedule function in my project. So I Googled for an Alarm manager program but I can`t find any examples.
Can anyone help me with a basic alarm manager program?
14
votes
4
answers
12k
views
Android Kotlin: Getting a FileNotFoundException with filename chosen from file picker?
I'm working on an Android application where one of the features is to let the user choose a file to open (I'm wanting to open a plain text .txt file). I've worked on Android apps before with Java, ...
227
votes
11
answers
256k
views
How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?
From Android 9 Pie now, requests without encryption will never work. And by default, the System will expect you to use TLS by default.You can read this feature here So if you only make requests via ...
16
votes
3
answers
14k
views
How to return a list from Firestore database as a result of a function in Kotlin?
I'm building an app for a friend and I use Firestore. What I want is to display a list of favorite places but for some reason, the list is always empty.
I cannot get the data from Firestore. This is ...
245
votes
19
answers
223k
views
The AsyncTask API is deprecated in Android 11. What are the alternatives?
Google is deprecating Android AsyncTask API in Android 11 and suggesting to use java.util.concurrent instead. you can check out the commit here
*
* @deprecated Use the standard <code>java.util....
2
votes
2
answers
3k
views
Kotlin DateTimeParseException
Getting date from https://api.spacexdata.com/v3/launches
This date have format: 2006-03-25T10:30:00+12:00.
I want convert it to "dd, mm, yyyy", but always getting error:
"java.time....
612
votes
15
answers
425k
views
How to make an Android device vibrate? with different frequency?
I wrote an Android application. Now, I want to make the device vibrate when a certain action occurs. How can I do this?
539
votes
8
answers
423k
views
How to convert a Kotlin source file to a Java source file
I have a Kotlin source file, but I want to translate it to Java.
How can I convert Kotlin to Java source?
206
votes
4
answers
93k
views
In Kotlin, what is the idiomatic way to deal with nullable values, referencing or converting them
If I have a nullable type Xyz?, I want to reference it or convert it to a non-nullable type Xyz. What is the idiomatic way of doing so in Kotlin?
For example, this code is in error:
val something: ...
379
votes
39
answers
556k
views
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15
In Stripe, my client wants email and cardholder name, but the Stripe payment UI doesn't provide that option in com.stripe.android.view.CardMultilineWidget. I wanted to give it a try with the latest ...
236
votes
17
answers
531k
views
How to parse JSON in Kotlin?
I'm receiving a quite deep JSON object string from a service which I must parse to a JSON object and then map it to classes.
How can I transform a JSON string to object in Kotlin?
After that the ...
250
votes
39
answers
271k
views
android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify
After upgrading to android 12, the application is not compiling. It shows
"Manifest merger failed with multiple errors, see logs"
Error showing in Merged manifest:
Merging Errors:
Error: ...