Skip to content

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 stack…

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 lik…

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 …

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 …

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&#821…