I have a functioning app where users can signup/login, upload images, and view images that have already been uploaded by themselves, they can’t see other’s images and vice versa. My rules are therefore UID of requesting user = uid of user who uploaded the image. Here is the code: Here are the corresponding realtime database rules. It should be a
Tag: android
Wear OS onKeyDown not firing for Ticwatch E
I have a Ticwatch E connected using ADB and I’m viewing the logcat. There is only one button on this device but when I press it, my onKeyDown method does not fire. I’ve been reading the Android documentation on Physical buttons, and have followed what they have specified. Here is my code: My stackoverflow searching uncovered this: Android wear activity
why my items are not showing in wishlist in android studio
I am working on an application where I want to add items in the wishlist section. I have some data which I am fetching from the firestore in recyclerview on each item I have a heart icon when someone clicks on that icon that particular item should be added to the wishlist section. I am new to android please guide
How to handle the Usb Permission Dialog Event on android when using the “device filter” solution?
I’m trying to handle the event when a user presses “ok” or “cancel” on the automatic permission dialog presented when I connect a “known” USB device to the android phone. I’m using the android.usb.host library and can send and receive between the android phone and the device. Futhermore do I handle the “USB_DEVICE_ATTACHED” and “USB_DEVICE_DETACHED” using a BroadcastReceiver without any
App crashes when I press “continue” button (transitioning between activities)
I am creating an app where you log in and then access a database of files unique to each user account. I have a continue button linking the “LoginActivity” and “MainActivity” activities together. The code that I have in the LoginActivity file is this: and on the MainActivity side I have this: What is wrong with my code? I can’t
Incorrect displaying items in RecyclerView while scrolling
Could you please assist in following issue: I have incorrect displaying items in my messenger app. My layout for items: My layout for dialog activity: Class DialogActivity Adapter class In this place I check user name. If user name is my name then I set message and visible to holder.messageMyMessage. Else I set message and visible to holder.messageYourMessage. But sometimes
How to access “types” dynamically with java?
I don’t know what types.DocumentType is, but I’m doing an integration of an sdk and I created a cordova plugin. the import from the sdk is like this: Can I somehow pass RG_FRENTE dynamically as it is done in javascript? Something like: Answer This solution is only if DocumentType is enum class like below. You can directly get by the
Unable to fetch unread messages from SMS inbox
I have successfully retrieved all messages from inbox but I want only unread messages . I have also apply in the query as read=0 which gives unread SMS but it can’t retrive unread messages it retrieves all messages. Answer Change your query arguments like this You are passing selection where clause for read = 0 in projections instead of where
How to set the width and height of a layout in Android?
I have this ConstraintLayout: lateinit var myConstraintLayout: ConstraintLayout I try to set its width and height to match its parent via code, like this: But I get error androidx.constraintlayout.widget.ConstraintLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams Why? How do I fix this? Answer The LayoutParams need to be the LayoutParams type of the parent ViewGroup. It is the parent ViewGroup that actually
Merging 2 regex that allow only English and Arabic characters
I have a string and I want to remove any other character such as (0..9!@#$%^&*()_., …) and keep only alphabetic characters. After looking up and doing some tests, I got 2 regexes formats: This should return “hello مرحبا ok”. But of course, this will return an empty string because we’re removing any non-Latin characters in the first regex then we