How can multiple Buttons in fragment load different data - android-studio

This is the UI, I want to the top button onclick different data but not move another fragment.
My architecture use the courutine Room,

Related

MFC: What method is used to set the toolbar buttons to be a subset of the total toolbar buttons by default?

I want to add all menu items to the toolbar but only have a subset of them showing by default (without user having to customize). This way all menu items will have icons next to them, but the toolbar won't contain the seldom used items unless users adds them.
If possible, how is that done with CMFCToolBar?
If possible, how is that done with CMFCToolBar?
You can define any number of 'dummy' toolbar resources in your program's resource script, like the below example, where ID_DUMMY1 is the toolbar/bitmap resource ID (must be available to both the resource compiler and the C++ compiler) and the three ID_COMMAND_x IDs define the menu commands that the images correspond to:
ID_DUMMY1 BITMAP L"DummyToolbar.bmp" // 16 x 48 bitmap for three 'buttons
ID_DUMMY1 TOOLBAR 16, 16
{
BUTTON ID_COMMAND_A // Three commands corresponding to the three button
BUTTON ID_COMMAND_B // images in the above bitmap
BUTTON ID_COMMAND_C
}
Then, in your program (typically, just after you have initialized your main frame window), you can call the static member of the CMFCToolBar class, AddToolBarForImageCollection to load the images from those dummy toolbars. The following will load those image in the above-defined resource:
CMFCToolBar::AddToolBarForImageCollection(ID_DUMMY1, ID_DUMMY1);
After this, every menu item with the given command(s) will show the associated image as defined in the dummy toolbar resource(s). You can have as many such toolbar resources as required, and just call the AddToolBarForImageCollection for each one.
Note: Although I have used the same resource ID for both toolbar and bitmap resources, you can also use different IDs. So long as the arguments given in the call to AddToolBarForImageCollection are properly coordinated, the method will still work.

Nested scroll view set Disable not working

Respected Android Programmer,
I am facing the one major problem is that nested scroll view not get disable. Here I am using RecylerView inside the Nested ScrollView.
Actually I am using the so many fragments in one Activity so when default recylerview loaded the listing user the Nested Scrolview now i have to click on floating button i have to hide the that fragment with with trance parent layout or frame layout. Its done but now problem is that when i use all function of recycler like
NestedScrollView mScrollView;
mScrollView.setNestedScrollingEnabled(false);
Not working may i know the reason.
Best
Romesh Chand

How can I properly load a different Activity layouts based on screen size with Mvx?

I'm developing an Xamarin Android Mvx5-beta application. When running on a small-screen device, I want to show a drawer navigation using the Toolbar and the hamburger-icon. On larger devices, e.g. tablets, I want a different layout conaining three columns. No drawer navigation but a static panel with navigation options and two other panels for content.
I started with the examples XPlatformMenus and Fragments to get a drawer navigation layout combined with the use of activities (with fragments) in different layouts qualifiers, like:
Question:
Using this approach, Android automaticly looks for an activity with the same name (e.g. main_activity.axml) in the appropriate layout-qualifier folders. But on the larger screens I don't need a drawer layout and I do need an extra column. The Mvx-viewmodel does not yet know what layout to render, so it just calls:
ShowViewModel<HomeViewModel>();
ShowViewModel<MenuViewModel>();
These ViewModels, for example MenuViewModel, are registered for fragments that require a navigation_frame, as shown in here:
[MvxFragment(typeof(MainViewModel), Resource.Id.navigation_frame)]
[Register("mydemoapp.droid.views.fragments.MenuFragment")]
public class MenuFragment : MvxFragment<MenuViewModel>, NavigationView.IOnNavigationItemSelectedListener
{
<..>
}
So, rendering this same Activity in layout-sw600dp requires a navigation_frame. Which I don't want on these larger displays.
What would be the preferred design choise in this situation? I can think of two:
Show/hide elements in the Activity programmatically by querying the screen info
Don't make use of layout qualifiers, but design complete seperate Activities for larger screens and based on screen size let MVX Show ViewModel-A or ViewModel-B.
Any advice would be appreciated, many thanks in advance.
I think it depends how different your layout need to be between large screen and small screen form factors.
Few UI differences
In addition to using different layouts, you can define a bool property in your XML values resources that is different between standard and sw-600dp
values
<bool name="is_large_screen">false</bool>
values-sw600dp
<bool name="is_large_screen">true</bool>
You can then read this value in your Android views and prevent methods like ShowViewModel<MenuViewModel>(); firing when on large screens by altering the method calls from the view.
Many differences/Structural differences
If they share the same business logic but have very different UI requirements and you want to keep large screen code separate. Then I would suggest sharing the ViewModels but creating two separate Activites and layouts to handle the UI presentation. Using this method requires a bit more setup as you have to override some default MvvmCross behaviors as by default you can not register multiple Activities/Fragments to the same ViewModel. Overriding the MvxViewModelViewTypeFinder view lookup FindTypeOrNull you can intercept the lookup and filter types base on naming conventions. For example all large screen views end with "Tablet". Using the is_large_screen bool you can flag which views to register.

Input with overlapping elements inside a FrameLayout

I have a game (Unity3d) that is running on Android where its View is contained in a FrameLayout. The game view covers the entire screen.
I am adding (in code) another view next to this view another button view (the 2 views overlap - see images below).
The button does not receive any input.
According to the documentation for FrameLayout, it is advisable to use a single element under it, but multiple views are also possible.
Why does my button not receive any input?
Attaching the view state as captured in Eclipse.

How to create an custom View for ListView?

How to create an custom ListView? I have Adapter, but I don't understand how to create an View like ListView of the Facebook, or App for SMS native from device... I'm needing background for TextView, this background, will have an arrow pointing left or right, I tried to create a View using canvas, but it is very difficult...
Every line in the listView of a layout which can be as complex as you want.Just you need an extra xml file for managing you custom layout (it should be contains widgets,fields,images etc as your design ) and the adapter would inflate this layout file for each row in its getView () method and assign the data to the individual views in the row .

Resources