I am creating a custom component in HarmonyOS using Java SDK, Where I have to perform some task after some delay with Component instance. In Android, we have postDelayed(Runnable action, long delayMillis) method in View class. So we can achieve above requirement as follow but, In HMOS java SDK, I seen there i…
Tag: android
How to covert vw measurement to dp in android?
Android Studio Code Snippet I have an android device that has it’s maximum width and height specified in dp units. Max Width – 1079 dp Max Height – 399 dp I want to create a LinearLayout that has to be present vertically and horizontally centered with its height to be in wrap_content length …
Android RecyclerView content not updating after notifyItemInserted
I’ve got a RecyclerView that needs to update in real-time when content is received. It successfully shows all the content at first load. When attempting to add a new item dynamically, it makes no difference. Is there anything I’m doing wrong here? Much appreciated! MainActivity: Adapter: Standard …
How to search in firebase database
I’m trying to filter the data from my database using this code: My database is like this: While the code works, it only returns the first value that matches the query and doesn’t fetch the rest of the data even though it matches. If I put a “T” as my search query, I just get the first …
Android Colors in Dark Mode
Hello fellow developers. I’ve developed and Android App using Android Studio, but I only took into account the layout themes for light mode. Here’s how it looks: So now, when I switch my phone to dark mode, this happens: How can I change the colors that are being displayed in dark mode? Answer In …
Webview from Android Studio does show a navigation menu and background logo
Context I’m trying to implement a webview for my website, using Android Studio and Java. Here is the code for MainActivity.java AndroidManifest.xml activity_main.xml Problem My webview does not show the navigation menu (dots) and the banner. The following two screenshots show my webview (left) and the w…
How to set ImageView in the AlterDialog Box
I am fetching the text and imageUrl from Firebase Realtime Database. I want to show the image and then display the text in the AlertDialogBox. I am able to fetch the text and imageUrl. Able to set the text using setTitle() but when trying to display the image, not able to implement so. Referred this but there…
Xamarin MAUI No Active Admin Security Exception (Kiosk mode app)
I’m trying to run an app on the android emulator with full kiosk mode. So I wrote a DeviceAdminReceiver: Here’s the MainActivity: And finally here’s the AndroidManifest.xml: > The problem is that this line in MainActivity throw this exception: I already have a device_admin.xml in resource…
imageView.setVisibility(View.GONE); not working for ImageView
I am trying to implement imageView.setVisibility(View.GONE); if my URL is null then the visibility of the imageView should ne GONE or else it should be VISIBLE. In my XML I have defined it as android:visibility=”gone” and if the URL is not null then I am displaying the image. The issue here is, it…
Android handle virtual Direction pad on screen to focus view
I’m developing an app can visible Direction pad on the screen, but I don’t know how to handle or override action like UP, DOWN, LEFT, RIGHT to focus the next view (like some buttons in image below). Answer I found a solution to what I need here Android simulate key press . Use Instrumentation clas…