Kotlin Questions
Ad
How to refresh the UI of a fragment using LiveData after Firestore data loads
I'm making an android app using kotlin with firebase products. i have successful connections with firestore and can successfully retrieve the data
How to save Firebase dataSnapshot object and key into Kotlin DTO data class?
The objective: update firebase realtime database from an android device. my data structure simplified:
Firestore/Firebase not able to get images from folder
I have a folder on firebase. which named 'item'. 'item' contains 100 images. i just want to fetch just all images url in the list. i
why I always get empty documents when using pagination in Firestore
I am trying to use pagination by using document snapshot to define the query cursor. when to fragment is opened for the first time, in
Adding value to a list in Firebase Database
I'm working on a kotlin app. it requires me to create my custom data type (user.item) that represents an item. i'm using a mutable list to work
Why are my email and password variables coming up as unresolved references?
I am using kotlin to build a basic an account creation form through firebase, and for some reason my variables are not being recognized and i
Saving Fragment EditText contents via the main activity FAB button onClickListener
I have a tabbed scrolling activity with several fragments as follows: com.example.myapp ui.main
NullPointerException: while calling a method from another class
I have this function that tries to call a method in an android activity using the below firebase addchildevent listener but i get a "nullpointer"
Kotlin lateInit has not been initialised error crashing application
I have an android kotlin application fragment with three elements in the resource layout:
when to use firebase functions and when to use firestore client functions?
I have a project where i need to write a data along with an image i.e to both cloud storage and firestore
Ad
How to get Data from Firebase using Kotlin?
I'm trying to get an information ('firstdate') saved in firebase using this code: if(currentuser != null){ val ref =
For some reason cant deserialize object from Firebase response
Everything looks good. need help in finding a mistake in code. by the logs that is the snapshot from firebase datasnapshot
Combine queries in Firestore
Currently i am working on a running tracker app for android phones. for this i will make a follower part also and a news feed. my question
Manifest merger failed when try to connect to firebase
I am trying to connect my app with firebase so i added classpath, implementation and "apply plugin" to my graddle files
how can i insert CALLBACK code in my code
When i created join action and login action on android app, aa problem has occurred. working with mvp pattern in login action. but the results on
Coroutines And Firebase: How to Implement Javascript-like Promise.all()
In javascript, you can start two (or more) asynchronous tasks simultaneously, wait both of them to finish and then do something/continue:
why firebase registration with textwatcher is not working?
I'm building the registration activity in which i use a textwatcher to see if email or password are empty, if all is correct is supposed to go
How can I use a scanned variable (Barcode) in an SQL query
I am trying to use a scanned barcode as a variable in a sql query. i am using the google ml kit
Failed to convert value of type 'java.lang.String' to required type 'java.util.Date' when sending GET request
I have this method in my controller (this is a kotlin method, but i think you can understand it): open fun getais(
What is the fastest way to encode a bytebuffer image in jpg format?
I use camerax to capture an image from the camera using
How to get data from Firestore based on the person who is assigned to with many different ZIP Codes?
Following is the code i use to pull the data out from the firestore. however, as part of the development of the app, my requirement
Ad
Can someone explain this recycler view adapter for me, the class header and such
Im trying to create an app with a recyclerview, and i am trying to figure out the following code from an android example. like what is the onclick
Kotlin "variable expected" error when doing assignment to Array element
I'm writing the following nested function where dfsvisit uses the arrays "numcaminos" and "colores" declared in the outer
is there any way to dynamically convert the English API response received through Retrofit to any other language?
I created a quotes app, using an api to call the quotes, using retrofit, and now i want the app to have the option of translating all to
Kotlin: Nested array indexOf()
Kotlin newbie here -- is there a "neater" way to do this? (my int values are guaranteed unique across the entire set) fun
Why (Not?) Pass Context to Android ViewModelFactory
I am refactoring applications that pass "application context" to the view model factory and is accessed in the view model. is there a
Enable button if checkbox is selected in Kotlin?
I want to enable a button if checkbox is selected or checked and disable it if unselected or unchecked. i started all my application using kotlin.
lateinit property apiInterface has not been initialized kotlin.UninitializedPropertyAccessException:?
I am writing unit test for my viewmodel when i run test i am getting following exception lateinit property apiinterface has not
How to add animtion in Horizonal Pager in Jetpack Compose?
I have a horizonalpager but there is no animation means it goes to second page suddenly i want that it animates to go softly or little bit slow
Compare and swap value in atomic integer kotlin
Hey i am learning atomic integer in kotlin. i want to know is there atomic integer swap value if current value is smaller than new value. for
Using insecure protocols with repositories build.gradle react native
I'm trying to install this library
How do I add regex to @Pattern annotation to match one of two specific strings or a null?
I've added @pattern annotation to a query parameter in my rest controller (springboot kotlin). i would like the regex in the pattern to accept
Ad
How to better organize the hierarchy of classes
I have an abstract class image filter: abstract class imagefilter { internal abstract val size: int fun
Firebase Realtime Database wait until the data is retrieved
I have a map containing the keys of my firebase realtime database and want to retrieve the corresponding key data and put it in the result data
How can I retrieve data from all sub-nodes of a node from Firebase?
I have a firebase database that looks like this
Binding an Int-List to a view (which is already in a bound outer recycler view)
I am from the c# world and am taking my first steps in the kotlin/android environment. i am a bit spoiled by the mvvm binding in c# and
Extending Rx Singles zip infinitely
I need to make a lot of api calls asynchronously and obviously make sure that they all pass so i can handle error/success in a single place.
How to get the caller from an event handler as an object in Kotlin
I am really new to kotlin and since i'm not used with the terminology i haven't found anywhere how can i get an object from an event caller.
Apply custom mask to an ImageView
I want to adust my imageview like this:
Read-only mutableStateListOf
In jetpack compose, if i have a mutablestate variable, i can expose it's state as "read-only" value to
How do I fill a matrix with 0 in Kotlin?
I need to fill an 8x8 matrix just with 0. i know it is possible to do the following: board = arrayof(
Validating EditText to having time in kotlin Android
I have a screen which have 2 edit text one edit text shows hour and other shows minute
Android Kotlin Coroutines Freeze
I have come across an interesting coroutines freeze that i have simplified into the following problem: //running on main thread
Ad
Custom Floating Action Button with TextView on top of Image
I'm trying to create something similar to the picture. i am using coordinatorlayout, bottomappbar and
How can I use recycler viewer with a fragment on a tablayout (android studio Kotlin)?
The error in "adapter = useradapter(users)" says type mismatch required: context "change parameter context type of primary
I'm receiving Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class androidx.fragment.app.FragmentContainerView
So i was trying to get my fragments with navigation component to work, but for some reason i'm getting that exception. i already searched for some
why first row in tic-tac-toe game works strange in runTime (android studio, kotlin)?
I have write a code for a tic tac toe game with android studio, kotlin. according to some of youtube videos the logic is ok but after running the
When recomposition happens exactly? with changing the state or also with changing the input
As far as i understood, each part of code which is related to any state will be changed(recomposed) with state changes → and each state
How to replace the content of a TopAppBar dynamically?
Imagine i have a topappbar (1) like
Popup Dialog Box doesn't work, app crashes
I wanted to do a small popup window (dialog box) with textinputlayout, textview and button. the thing is i
Android Studio doesn't let me use repeatOnLifecycle
I want to observe data inside my fragment from viewmodel, but android studio keeps triggering this warning. can someone help with this problem?
Could not find SDK on kmm with AppCode
I am very new to kotlin multiplatform mobile and tryed to start with appcode and the kmm plugin. creating and running the project on android
Is that possible to use variables when calling an string from resources?
I know it's a silly quastion but when calling a string from resources(r.string.xxx), are there any ways to call an string name using
Open the "Documents" directory of my app calling the Google Files app
I am developing an app and i should open the "documents" folder of the directory of my app using the google files app (presumably using
Ad
remoteMessage firebase expecting function invocation
I'm learning firebase cloud messaging. i've implemented it in app run notification, but it seems that doesn't work. the problem is that, when i
make each word clickable in jetpack compose
Clickabletext will return position of clicked character but is it possible to make each word clickable and return it? @composable
Composable is recomposing endlessly after flow collect
My composable is recomposing endlessly after flow collect and navigating to a new screen. i can't understand why. i'm using firebase for
kotlin reject negative, string and float input
I'm not allowed to change the tointornull() and i need to reject every string, float, and negative input. i tried to do it with
How to change the background color of selected item in RecyclerView
I created a kotlin mobile app. in my app i use the recyclerview with adapter. i want to changing the background color of item
How to connect via WebSocket on Android using Scarlet?
Code from readme.md val scarletinstance = scarlet.builder() .websocketfactory(okhttpclient.newwebsocketfactory(gdax_url))
Is there a way to perform a Firestore query that would work like `whereEqualToAny(field, list/array)`?
I have a requirement where in i need to query all documents with a field that can match any of the values inside a long list of strings.
Why can't I get Int types from my Firestore DocumentSnapshot?
I can get any type from my firestore
Populating Data Class via Simple Firebase Calls
Running into an error i have been researching and attempting to fix for the past couple weeks. there are tons of suggestions out there and i've
How can I switch kind of protocol that I prepared to work with?
I understood that chirp use 16khz-mono protocol for transmitter data in android. can i switch kind of protocol that i prepared to work with? and
Dagger missing binding while adding AndroidInjector
I have the following problem: i started to study dagger 2 and trying to add injections to my app class. here's the code of my app class:
Ad
How to get LiveData from Room?
I'm trying to get livedata from room. so my recycleview can have live updates if anything in database is changed i have tried with out
How to inject Network module like this?
I cannot think how to inject network module.i try and find many way to inject network module in dagger 2.but i cannot solve this.please help
Random crashes when using kotlin coroutines
I am using a recyclerview to show images / videos from sdcard, like a gallery app & recently i migrated to kotlin and tried using
After migrate to AndroidX: "Unresolved reference: ..."
I got some errors in my application and found this solution: click now,
Can't catch network error when using coroutine, but the error could be caught in RxJava 2. What did I miss?
I have the following code using coroutine to perform network fetching on background try { networkjob =
what is ViewModelFactory
What is viewmodelfactory and when and why should i use it i am new to android and actually i can't understand these concepts in mvvm
How to hide keyboard. System services not available to Activities before onCreate()
System services not available to activities before oncreate() i have dialog class mypersonaldialog(mcontext: context) and this dialog
How to mock a system class for type casting
I have the following code to get the current system memory: val memclass = (context.getsystemservice(context.activity_service) as
Toolbar creating problem for custom theme in Navigation view?
This is my first time learning to implement custom android themes, i don't understand my styles.xml code much. i want to set the
Running a shell command on Android returns nothing
I've been trying to get the output of a command for quite some hours now but with no result. having this code: val bytearry =
Android Firebase onEmailVerifiedListener
I have a verify email activity - "we send email to.." and so on. i want to create "onemailverifiedlistener" by starting the thread in this
Ad
Kotlin Firebase onFailureListener null exception
I am trying to update email of user in my android app. and everything works fine if the new email is available. when it isn't - onfailurelistener
I have some problems with DrawerLayout
I'm working with drawerlayout in my program, and my program has only one activity, and many fragments. when i open new fragment how can i block
Refactoring from Java to Kotlin, having trouble with Generics
Can anyone help with refactoring this class to kotlin, having trouble with generics conversation. model: abstract class
update existing key of HashMap
I have hashmap < integer,string> of length 3: 1=>"value1" 2=>"value2" 3=>"value3" now i want to
How to handle multiple NavHosts/NavControllers?
I'm having a problem when dealing with multiple navhosts. this issue is very similar to the one asked
Prerequisite to create extension function in kotlin
I am learning kotlin. as per i learnt, extension functions provides the ability to extend a class with new functionality without having to inherit
Is it possible to convert Kotlin to Java using Android Studio?
I have a kotlin project that i need to convert in java. i don't know if it is possible in android studio ? can the kotlin's logics be converted in
Using DiffUtil and custom adapter cause Inconsistency detected
Currently i tried to use diffutil to notify the items of recyclerview in my project. meanwhile, i wrote a custom adapter which could add
Does OkHttp 4.0.0 require JVM target 1.8?
Is okhttp 4.0.0 intentionally incompatible with jvm target 1.6? upgrading from okhttp 3.12.0 to 4.0.0 i run into the following build failure.
What is the include file of getURLForResource()?
I'm creating an app that want to get some url at the time of execution on the app layout folder. how can i get the url on the application run to
Gson - How to parse partial json in Kotlin
I have a data class called model, data class model(var name: string? = null, var address: string? =
Ad
Generic type param in interface
I have an interface, interface a<in t> { fun onsuccess(response: t) fun onfailure() }
RxJava2 Error Handling Wrapper For Retrofit Service
I need to handle error globally in my application for network service, i am using rxjava2calladapterfactory in my retrofit service. so in order to
Type inference failed: Not enough information to infer parameter T Kotlin
I am using a sealed class to return data from network. but when i am building the project i am getting the following error
How to set "ImageView" to be clickable or non-clickable
I am making a simple memory game. it basically, some imageview come up and after that user should click imageview
invalidateOptionsMenu() deprecated
In one of my fragment class, i using invalidateoptionsmenu() as below invalidateoptionsmenu(activity)
How to stop emission from PublishSubject when buffer is empty
I'm trying to create a sequential download service using rxjava. user can add items in batch (20, 30 etc) or individual item. these items will be
Kotlin flow - Is flow created once for each collector?
I know flow is cold, and
Android Studio build error - unable to preview UI in preview window
Frankly speaking, i don't have the knowledge to understand and debug this error. so please inform me if i miss something. how am i
How to add authorization bearer header to webview android?
I have to send bearer at headers. i saw that i have to add hashmap with values: val headermap = hashmap<string, string>()
Two similar code constructs but one does not work
The following are two blocks of code that should essentially do the same thing. but the second one does not execute the oneditoraction while the
How to set an onClickListener to a button in kotlin
I am working on a android studio project which is a hybrid of kotlin and java. i am trying to set an onclicklistener to a button, however i keep
Ad
How to bind SQLite FTS4 query params in Kotlin
I wonder how to bind sqlite fts query params for sanitizing inputs. i was trying to run a raw query like below which ended up with a
Coordinator Layout and some other layouts not working after migration to androidX
I recently migrated my project to androidx using refactor. all the implementations were automatically changed to androidx. but i am not able use
Ad
Blog Categories
Ad