Skip to main content
Filter by
Sorted by
Tagged with
888 votes
23 answers
565k views

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 stack ...
nhaarman's user avatar
  • 101k
33 votes
4 answers
10k views

(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 ...
a_local_nobody's user avatar
578 votes
19 answers
571k views

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?
Bastian's user avatar
  • 9,805
398 votes
10 answers
379k views

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?
Rajamohan Sugumaran's user avatar
14 votes
4 answers
13k views

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, ...
CalicoSkies's user avatar
231 votes
11 answers
280k views

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 ...
Xenolion's user avatar
  • 12.8k
16 votes
3 answers
14k views

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 ...
Jane Ashley's user avatar
249 votes
19 answers
239k views

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....
Zeeshan's user avatar
  • 12.4k
2 votes
2 answers
4k views

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....
bboy's user avatar
  • 65
615 votes
15 answers
432k views

I wrote an Android application. Now, I want to make the device vibrate when a certain action occurs. How can I do this?
Billie's user avatar
  • 9,176
550 votes
8 answers
440k views

I have a Kotlin source file, but I want to translate it to Java. How can I convert Kotlin to Java source?
activedecay's user avatar
208 votes
4 answers
100k views

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: ...
Jayson Minard's user avatar
406 votes
45 answers
669k views

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 ...
Karthy Sbk's user avatar
  • 4,183
238 votes
17 answers
556k views

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 ...
AJ_1310's user avatar
  • 3,443
257 votes
39 answers
288k views

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: ...
Ashique Bava's user avatar
  • 2,736
3 votes
1 answer
2k views

I am trying to save user credentials to Firebase Realtime Database. However, when I execute the program, the DB does not update. I have configured the Firebase setup correctly as Authentication and ...
Mughees Asif's user avatar
92 votes
10 answers
173k views

Using the Connectivity Manager Class we can get access to either wifi or Internet Network: ConnectivityManager connec = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); // ARE WE ...
Rohit Sharma's user avatar
  • 13.8k
120 votes
6 answers
262k views

When calling the saveAll method of my JpaRepository with a long List<Entity> from the service layer, trace logging of Hibernate shows single SQL statements being issued per entity. Can I force ...
Tobias Hermann's user avatar
18 votes
1 answer
10k views

I'm doing experiments to comprehend recomposition and smart recomposition and made a sample Sorry for the colors, they are generated with Random.nextIn() to observe recomposition visually, setting ...
Thracian's user avatar
  • 70k
238 votes
24 answers
269k views

I am trying a sample with Room Persistence Library. I created an Entity: @Entity public class Agent { @PrimaryKey public String guid; public String name; public String email; ...
Devarshi's user avatar
  • 16.8k
13 votes
2 answers
9k views

For my Android project, I need global singleton Cache object to access data about a user through the app. A problem occurs when an app goes into the background and after some time of using other ...
Nikola Samardzija's user avatar
434 votes
13 answers
195k views

And the Kotlin newbie asks, "why won't the following code compile?": var left: Node? = null fun show() { if (left != null) { queue.add(left) // ERROR HERE } } Smart cast ...
frankelot's user avatar
  • 14.5k
6 votes
2 answers
3k views

Hey I am using Paging 3 library with ViewPager 2. In which it loads unlimited data. implementation "androidx.paging:paging-runtime-ktx:3.0.0-alpha07" DataSource.kt package com.example....
Vivek Modi's user avatar
  • 7,859
169 votes
29 answers
91k views

I'm using the new support library ListAdapter. Here's my code for the adapter class ArtistsAdapter : ListAdapter<Artist, ArtistsAdapter.ViewHolder>(ArtistsDiff()) { override fun ...
Veeresh Charantimath's user avatar
6 votes
2 answers
11k views

I am following a tutorial exactly. I gave the view a name in the layout XML file under android:id. When I type that name in Kotlin, it is highlighted in red and there is an "unresolved reference&...
Tenfour04's user avatar
  • 95.1k
104 votes
15 answers
171k views

In my Kotlin project, I have some parts of Java code that I want to convert to Kotlin. The menu item that converts the Java file to Kotlin is disabled because it's not a whole file I want to convert. ...
Alan Coromano's user avatar
269 votes
13 answers
163k views

After upgrading my phone to 8.1 Developer Preview my background service no longer starts up properly. In my long-running service I've implemented a startForeground method to start the ongoing ...
Rawa's user avatar
  • 14k
409 votes
30 answers
217k views

What is the difference between var and val in Kotlin? I have gone through this link: KotlinLang: Properties and Fields As stated on this link: The full syntax of a read-only property declaration ...
Akshar Patel's user avatar
  • 9,498
371 votes
36 answers
1.2m views

I've got a gradle FAILURE: ..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0." Case description: Attached to the project codebase the next libs: APP/build....
Philipp Buhaievskiy's user avatar
369 votes
5 answers
169k views

What is the difference between List and Array types? It seems can make same operations with them (loops, filter expression, etc..), is there any difference in behavior or usage? val names1 = listOf("...
Daniel Hári's user avatar
  • 7,844
130 votes
8 answers
36k views

How is it related to extension functions? Why is with a function, not a keyword? There appears to be no explicit documentation for this topic, only the assumption of knowledge in reference to ...
F. George's user avatar
  • 5,434
12 votes
1 answer
3k views

I am developing an application to detect the lesion area, for this I am using the grabcut to detect the ROI and remove the background from the image. However in some images it is not working well. He ...
Carlos Diego's user avatar
455 votes
4 answers
165k views

I'm trying to understand the purpose of the reified keyword. Apparently, it's allowing us to do reflection on generics. However, when I leave it out, it works just as fine. When does this make an ...
hl3mukkel's user avatar
  • 6,119
383 votes
20 answers
197k views

How do I fix the deprecation warning in this code? Alternatively, are there any other options for doing this? Handler().postDelayed({ context?.let { //code } }, 3000)
Bolt UIX's user avatar
  • 7,182
452 votes
70 answers
305k views

I kept on getting an error that there is a duplicate error in classes. This is what I have under org.jetbrains.kotlin folder .idea/libraries It seems like the problem is because there is two different ...
midnighthowlers's user avatar
83 votes
12 answers
90k views

Should I be worried about JCenter being deprecated? Why should I migrate my libraries from JCenter to other Maven repositories? Can I continue to use jcenter() in my Gradle build script?
Mahozad's user avatar
  • 26.4k
11 votes
1 answer
7k views

I need size of my composable to draw dynamic lines but I don't want to get size by: var size by remember { mutableStateOf(IntSize.Zero) } Modifier.onSizeChanged{size = it} or Modifier....
uniqueapps's user avatar
281 votes
45 answers
597k views

Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details build:gradle(Module:app) buildscript { repositories { maven { url '...
Ankur_009's user avatar
  • 3,790
122 votes
10 answers
84k views

I want to invoke an external command from Kotlin code. In C/Perl, I would use the system() function. In Python, I would use the subprocess module. In Go, I would use os/exec, and etc. But how do I ...
Big Tummy's user avatar
  • 1,261
88 votes
3 answers
20k views

I want to see the compiled bytecode so I can learn more about how it works under the cover. I'm using IntelliJ IDEA 15 but can't find a way to see the bytecode. What am I missing?
CaseyB's user avatar
  • 25.1k
894 votes
33 answers
526k views

What is the equivalent of this expression in Kotlin? a ? b : c This is not valid code in Kotlin.
Drew Noakes's user avatar
289 votes
2 answers
484k views

I want to generate random number in a specific range. (Ex. Range Between 65 to 80) I try as per below code, but it is not very use full. It also returns the value greater then max. value(greater then ...
Mohit Kanada's user avatar
  • 16.1k
279 votes
43 answers
458k views

The following error occurs when I tried to build the app: C:/Users/Lenovo/.gradle/caches/transforms-2/files-2.1/32f0bb3e96b47cf79ece6482359b6ad2/jetified-kotlin-stdlib-jdk7-1.5.0.jar!/META-INF/kotlin-...
Saheel Sapovadia's user avatar
3 votes
4 answers
2k views

last night I noticed I'm not able to change the attributes of elements in the layout from my main activity so I built a new project and I had the same problem there too. I could not find out what was ...
radman hayati's user avatar
372 votes
15 answers
273k views

Data classes seem to be the replacement to the old-fashioned POJOs in Java. It is quite expectable that these classes would allow for inheritance, but I can see no convenient way to extend a data ...
Dmitry's user avatar
  • 4,472
299 votes
8 answers
227k views

I have 10+ variables declared in Kotlin data class, and I would like to create an empty constructor for it like how we typically do in Java. Data class: data class Activity( var updated_on: String,...
Sai's user avatar
  • 15.8k
233 votes
7 answers
72k views

What does a single exclamation mark mean in Kotlin? I've seen it a few times especially when using Java APIs. But I couldn't find it in the documentation nor on StackOverflow.
Mibac's user avatar
  • 9,518
100 votes
23 answers
185k views

I'm writing my first app in Kotlin after 3 years of experience with Android. Just confused as to how to utilize itemClickListener with a RecyclerView in Kotlin. I have tried the trait (edit: now ...
Afzal N's user avatar
  • 2,593
413 votes
63 answers
612k views

All of sudden I start getting this error, and I am not getting idea why if anyone just let me know where this error is, will be enough helpful. As much I am able to get is this because of new update ...
Shubham Tater's user avatar
332 votes
11 answers
273k views

I'm reading Kotlin coroutines and know that it is based on suspend functions. But what does suspend mean? Can a coroutine or a function get suspended? From https://kotlinlang.org/docs/reference/...
onmyway133's user avatar
  • 48.5k

1
2 3 4 5
138