android-fragments

Open different activities by clicking on different cards in CardView ,Recyclerview Fragment in Android studio

北城以北 提交于 2020-08-10 22:53:29
问题 I have created a RecyclerView and added cards in fragment.I want to open different activities by clicking on different cards in CardView.But I am only able to open the same activity for all the cards.I searched different answers in StackOverFlow.But I couldn't. could you tell me how to solve this issue...? If you can give full code,I'm happy. Here are my codes... PDFFragment.java public class PDFFragment extends Fragment { View v; List<Pdf> listBook; public View onCreateView(@NonNull

Open different activities by clicking on different cards in CardView ,Recyclerview Fragment in Android studio

人走茶凉 提交于 2020-08-10 22:52:57
问题 I have created a RecyclerView and added cards in fragment.I want to open different activities by clicking on different cards in CardView.But I am only able to open the same activity for all the cards.I searched different answers in StackOverFlow.But I couldn't. could you tell me how to solve this issue...? If you can give full code,I'm happy. Here are my codes... PDFFragment.java public class PDFFragment extends Fragment { View v; List<Pdf> listBook; public View onCreateView(@NonNull

How to use a simple onscroll listener on a recyclerview that is inside a fragment

独自空忆成欢 提交于 2020-08-10 20:29:25
问题 Ive been looking all over the internet and cant find the answer that works for me. I am trying to create a fragment with an infinite scroller (just like on social network apps like twitter, facebook, instagram, tumblr etc ) and research suggests that a recycler view is the best way. This image show you how i have done it. File -> new -> Fragment -> Fragment (List) If I'm correct, the next step now is to create an on scroll listener so that i know when the user has scrolled to the bottom as

Viewpager2 in fragment of bottomNavigation: NullPointerException

ε祈祈猫儿з 提交于 2020-08-10 19:35:10
问题 I have 3 fragments used in bottom navigation in Main Activity. In one of the fragments, I have screenslidepagefragment in viewpager2 which has 3 buttons. When I click on any of these 3 buttons I have this error E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.headlines, PID: 3209 java.lang.NullPointerException: Attempt to invoke virtual method 'androidx.lifecycle.LiveData com.example.headlines.Model.NewsViewModel.getData(java.lang.String)' on a null object reference at com.example

Show a loading spinner while a fragment is loading

时光怂恿深爱的人放手 提交于 2020-08-09 07:03:39
问题 I have developed a fragment-based app. I have a menu fragment with buttons,these buttons open a new fragment each one, replacing the last one. The issue is, that some fragment takes a while in opening cause it does some calls to asynctasks and populates some listviews. So when I press the button in the menu fragment, it keeps freezed 2 seconds until the new fragment appears replacing the menu fragment. I would like that a spinner or "loading.." dialog appears in that time. I have tested this

How to use NavigationExtensions.kt in a Java project?

萝らか妹 提交于 2020-08-08 19:03:42
问题 I'm trying to implement NavController with BottomNavigation in a new project. This is my first attempt and there is a lot of ambiguous information all over the place about this. So my question relates to each Bottom tab having its own back stack and persisting the fragments between bottom navigation taps. Yes, I have looked at https://github.com/android/architecture-components-samples/tree/master/NavigationAdvancedSample and I'm unable to understand how to integrate this with my existing Java

How to interact with other fragment when using Navigation architecture component?

爷,独闯天下 提交于 2020-08-05 17:59:32
问题 i want to add fragment B on top of fragment A without view of fragment A getting destroyed. Only option i see in navigation library is to use navigate method to open a fragment but how to ensure fragment B is added on top of fragment A, not replaced. navigationController.navigate(R.id.B, bundle); and how to find the instance of fragment A to be able to interact with it? 回答1: Will like to know so as to clarify myself. Why don't you want fragment A be destroyed when you navigation to fragment B

How to interact with other fragment when using Navigation architecture component?

有些话、适合烂在心里 提交于 2020-08-05 17:58:45
问题 i want to add fragment B on top of fragment A without view of fragment A getting destroyed. Only option i see in navigation library is to use navigate method to open a fragment but how to ensure fragment B is added on top of fragment A, not replaced. navigationController.navigate(R.id.B, bundle); and how to find the instance of fragment A to be able to interact with it? 回答1: Will like to know so as to clarify myself. Why don't you want fragment A be destroyed when you navigation to fragment B

Highlighting a menu item in system settings

夙愿已清 提交于 2020-08-05 08:22:50
问题 Trying to bring up an unaswered question I found here - How to highlight android setting app menu item? As seen in this video https://www.youtube.com/watch?v=eHXBc5Mmsqs The "Power Shade" menu item is being highlighted once you enter the screen. I am trying to add the same feature to my app, guiding users to an item in the settings menu using this highlight feature. I can't seem to find any information on how to actually implement this, nor do I know if it has a specific name I could search

How to coordinate a Navigation Drawer with a Buttom Navigation View

倾然丶 夕夏残阳落幕 提交于 2020-08-05 08:06:17
问题 I'm fairly new to android dev. I'm checking the material design library and I've implemented a navigation drawer with a bottom navigation to navigate easily through fragments. Both components work just fine but I don't how to coordinate the navigation with both components. For example when a fragment is toggled on the navigation drawer it changed the layout but the button navigation selected item is not changed with it. How can I solve this issue and link both components to work with each