In my MainActivity class, I have this button: I now want to add a badge with the number 1, using Material Design (see the documentation). This is how I tried: but what I get is the error ‘attachBadgeDrawable(com.google.android.material.badge.BadgeDrawable, android.view.View, android.widget.FrameLayout)&…
Tag: android
Merging multiple LiveData sources?
To make it easier to visualize my problem I drew the following: I am using a RoomDatabase, a Repository, a Viewmodel and Livedata. Areas have a 1 to n relationship with Gateways and Gateways a 1 to n relationship with Items. I created both an AreaWithGateways entity and a GatewayWithItems entity. Items can mo…
Add fragments (not replacing) with animation problem
When I used fragment (.add) method and used “fade_in/fade_out” animation When moving between them. It is gives me this error “java.lang.IllegalStateException: commit already called”. I followed this tutorial to add fragments and this question to use animation. Her’s my code Answe…
Not Showing Correct Position While Searching in Listview
In this program I give apple as 0th item and first item,banana as 2&3rd item and so on.. but while searching I want to show papaya as 17th or 18th based on which papaya I click . without searching it will correctly show the number of fruits location.but while searching it will show if 4 item shown in list…
How to Filter Data in RxJava in Android
This is the Json data that i need to filter. This my “ViewModel” Class I want to filter the data that i’m getting from json. I only what to display all the data that contains “Bắn cá 2021” using the “game_name” attribute. The “getTips” function that i made…
Java Stream why does reduce requires two parameters of the functional Interface?
In other words, why does reduce require BinaryOperator, or BiFunction interface? Why doesn’t it use UnaryOperator, or Function interface instead? What is the point of having two parameters as the input for the functional interface? (I know it’s for accumulation, but why doesn’t one parameter…
How can I change the drawable color of RadioButton’s background programmatically?
My radio buttons have background which is selector drawable. And I want to change the color of state_checked=”true” item’s drawable programmatically. The background of radiobutton : checkbox_membertag_active : and I tried in this way. I want to change the @color/white of active item to starC…
Android 11: Send e-mail with automatically attached file
I want open and email app with already generated text, subject, recipient and attached file, it works with android sdk version 29 (android 10) and lower. However starting Android 11 there are restriction to writing file in external or internal storages, and there is also another restriction that is not allowe…
Boolean setters and getters not updating upon button click?
So I am currently developing a date android application, now what I have done here is created a simple algorithm called similarDatesFunction this function is responsible for retrieveing data and matching it with the user input, for every match a counter will be placed, if this exceeds 6 counters also known as…
Issue in Native Ad Flutter using google_mobile_sdk
I want to monetise my Flutter app using google_mobile_ads library with Native ads. I am facing some issues while facing this documentation – https://developers.google.com/admob/flutter/native I am not sure where to put the my_native_ad.xml file so that it can be referred by the Kotlin Main Activity File…