Questions tagged [kotlin-android]

49 questions
0
votes
0 answers

Infinitely scrollable list

Please tell me if there are already existing good libraries of horizontally infinitely scrollable scrollers, preferably with an indicator display at the bottom. I have found several implementations, but I would like it to be implemented using…
0
votes
1 answer

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.location/java.lang.String};

I working on a flutter project which uses location services. There is one case where user 'denied permission forever', that time i need to open app location setting to turn it on and for that i'm using native code of kotlin. all code of native is…
RahulZx
  • 107
  • 2
  • 11
0
votes
0 answers

loop showing only 2 elements out of 10 after a live data observation

I am listening to an emit from a live data and want to loop through the list to Log them. if I do myList.toString(), I can see all 10 elements of the list. But my loop stops after logging two elements: myLiveData.observe(this, Observer { …
Erick
  • 63
  • 4
0
votes
1 answer

Download manger not able to download large files in android

By large file i mean 8.5 MB and by small files I mean 80KB to 1MB. while download manager can download files up to 2GB The below code is able to download small files but not large one. For the large files it shows the downloading notification but…
0
votes
1 answer

Android Bottom Sheet is not working in Fragment

I have added the bottom sheet dialog on a fragment. Right now I can't open it. Whenever I click on the show button it doesn't work at all. How can I fix this problem? CreateFragment.kt class CreateFragment : Fragment() { lateinit var binding:…
0
votes
1 answer

Java equivalent of the Kotlin's secondary constructor "apply"

I am having a problem. I need something similar to Kotlin's secondary constructor "apply" in Java. Kotlin: private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.YELLOW; style = Paint.Style.STROKE strokeWidth = 5.0f } I…
0
votes
1 answer

Could someone take a look at my project and tell me why it errors before running?

Hi and thanks for reading in advance, I have built a small project testing an adapter to populate a main activity view with a custom xml template [this template holds some fields that are populated by some simple test data and images inside the…
0
votes
1 answer

Should the index passed to notifyItemChanged consider placeholder items?

PagingDataAdapter from Paging3 library internally manages two semantically different lists. adapter.snapshot() returns a ItemSnapshotList which includes placeholder elements. adapter.snapshot().items return a List which excludes placeholder…
0
votes
2 answers

Defined color is not showing on drawable element - Android studio

I got a problem with color on my button.xml file in drawable folder. I have 2 rounded buttons, one with green background and one with grey. This is the code for my grey rounded button:
0
votes
0 answers

Can't consume localhost REST API on android application

I created a simple Restful Api using Spring boot and Kotlin, and I'm trying to consume it an android app but can't seem to do so. It's working fine on postman,in an Angular project and in the emulators browser(Google Chrome,…
cds
  • 1
  • 1
0
votes
0 answers

How to open an activity from different package (imported module) in android?

I have an android project (let's call this Base) in which I have added/imported a new project. Now, I have to open an activity in the new project (imported module) from the Base project. How could this be achieved? From the screenshot, I want to…
0
votes
1 answer

What is Diff between "contains" and "in" (Kotlin)

fun main() { val input = "ABC" val output = "ABC," println(input.contains(output,false)) print(input in (output)) } Output : false true I just checked that, in and contains are using same method, but why giving difference results.
Dev007
  • 222
  • 2
  • 9
0
votes
1 answer

What is the best way to declare a variable for a TextView that changes during lifecycle of Activity?

I decided to learn how lifecycle of an Activity works via changing different properties of a simple TextView at each stage of a cycle. I wanted to know what is the best way to declare a variable for the said TextView so I could use it within each…
0
votes
2 answers

How to transform PagingData into model in collectLatest() in UI

I am having a situation, where once I get pagingData , I need to get additional data from a different API. The second Api requires arguments that are there in first API response. Currently I am collecting in UI Layer in lifecyclescope…
0
votes
3 answers

Why textfield not catch text inside and don't add to database

When I press button with onSendClicked is not adding text from textfield. I don't know where not catching text. I guess is somewhere mistake with viewmodel, becouse viewmodel don't get new value. fun AddBar( onSendClicked: () -> Unit ){ …
Matt
  • 33
  • 5