Listview display tick icon when open - java

I assume that I have activity A, activity B, and activity C. in activity A there is a listview that displays the name of activity B and C. how do I display the tick icon on the listview in activity A when I finish opening activity B or activity C like the example image below.
example

Add an ImageView to the right side of your ListView item layout and set it to be visible just after calling startActivity(). Or, if this is making the checkmarks visible too soon, you can use startActivityForResult(), which will allow you to set the ImageView's visibility only upon returning to Activity A. If your ListView isn't using custom item layouts, you'll need to learn how to do that.

Related

BottomSheetDialogFragment behaviour disorder when added nested fragment in Android

I've a BottomSheetDialogFragment inside a RecyclerView, when is clicked a button BottomSheet is showing. BottomSheetDialog expanding when scrolling down and collapsing when scroll finished on top normally.
But when I place the RecyclerView inside a fragment and lay the fragment to BottomSheetDialog; BottomSheet behaviours not working on the fragment, only works RecyclerView scrolling. On the other hand the behaviours work other places on BottomSheet. How to enable the behaviours as in the first?
You should check that your container layout has app:layout_behavior="#string/bottom_sheet_behavior"> and check that any listener/event you define extra, otherwise BottomSheetDialog normally behaive as you expect.

How to add Buttons and other stuff like Image Viiew in default Bottom Tab Activity of Android

I am new to Android development and have created a new project with the ‘Bottom Tab Navigation’, unlike the blank activity where I get a java class and a layout activity and to put Buttons in the onCreate method the HomeFragment and HomeViewModel doesn’t have any of those fields. I want to add a few buttons And Image Views to them...Cam anyone please help me by telling where to put code like private Button xyz; and then xyz=findViewById()
You can add image and title in bottom navigation bar by going inside this path
res/menu/ bottom_navigation_menu.xml
You don't need to create the object of these buttons and texts. but if you want to access these items then define BottomNavigationView by findViewById() then call below method on this object.
BottomNavigationView.OnNavigationItemSelectedListener()
You need to implement onNavigationItemSelected inside this which will give you the ID's of all bar menus. I hope this will help.

Navigation Drawer Activity change fragment from external button

So I have set up the default Navigation Drawer Activity in Android Studio. I also added some buttons in the default navigation activity XML. The default navigation menu buttons obviously change the fragment, but I was wondering how I could also change the fragments via the buttons that I have added along the bottom? The reason I am having trouble is that the default nagivation menu buttons are part of a navGraph, whereas my buttons are not, thanks!
[][]
All you need to do is set onClickListeners on the button.
For example:
val postButton = findViewById<Button>(R.id.post_button)
postButton.setOnClickListener {
findNavController().navigate(R.id.post_fragment)
}

Start Activity with Sliding Menu slide animation

I implemented the Sliding Menu library in my app but I have an issue with the navigation.
In the behind view, I've set some buttons which when pressed change the Fragment of my current Activity. Normally, when the fragment is changed, the Activity slides back in it's place.
But I encountered a problem and I am forced to use a new Activity on button click. The thing is that, when I start the new Activity, it opens a new "screen" (as expected). What I want to do is to slide the screen back to it's original position with the new Activity in. Any way I could do that?
Basically, I want to launch an Activity with Drop-Down navigation and 2 normal activities.

Activity on top of mapview

I have a Activity on top of a MapView that only covers a small portion at the top to display additional data.This Activity is called when a Polygon is touched on the map. The issue that I am faced with is that the first activity gets disable when the second Activity is in view. Is there a way to still interact with the first activity when the second one is being displayed? Or is there a better way of accomplishing what I am trying to achieve which is displaying a custom view at the top of the MapView. Thanks

Categories