Android: Navigation Drawer, JSON Feed, RecylerView - android

So I have set-up a navigation drawer and a main layout that downloads JSON data and displays it in a RecyclerView in a tab fragment.
Now what I intend to achieve is that, when I click on a hardcoded item in the navigation drawer it calls the API corresponding to it, should filter the main RecyclerView based on the JSON parameter passed.
(eg: If the Main Layout RecyclerView shows all the Items that you can buy, and the Navigation Drawer contains items like Laptops, Cellphones, TV, Clothing etc and while clicking on NavDrawer item, it filters the RecyclerView to show only the items in that particular category)

Why don't you have fragments for each navigation drawer item? These drawers will make the API calls and present the received information in the RecycleViews they hold?
It would be much easier and better than reuse a single view to present different information on different actions...

Related

What is the correct way to approach ViewPager and Fragments when number of fragments are more than 50 but each of them has same layout and methods?

I am making an app which has a navigation drawer. This navigation drawer has 50 menu items. These items have the same layout, same activity but different data.
I want to implement ViewPager in my app so that the user could swipe left and right (manually and automatically).
Issue: I am facing an issue of how to implement this. The activity (for these menu items) has its own methods and functionality. A ViewPager can slide fragments but my issue is that since all of these menu items have the same layout and functionality then it would be much better to use one fragment whose data change with swipes for each menu items.
I don't know how to approach this. Please guide me.
You can do it by using a recycleView,and you will need an arrayAdapter which will help you adapt the data accordingly and you will need to have a separate class that will have all the data you want, you can also have different constructor in that class. You can check this to know more https://www.codexpedia.com/android/a-very-simple-example-of-android-recyclerview/

How can I build a multi-level expandable navigate UI?

I want to build a menu for restaurant. This is a tablet app, not on phone. The UI requires 3 parts. The left one is desired with a 2-level expandable navigation. When the client click one first-level item, system displays its second-level items. When the client change one first-level item, the new one will expand and the old one will automatically close. While client click a second-level item, the middle part will display the dishes in this category. Please refer the picture.
Main UI
Then, how should I design these parts? Can I put all in one activity? Or put 3 fragments for the 3 parts? I don't know if there are some differences of loading and refresh efficiency between the 2 ways.
expandable navigation
expandable navigation
Shopping Cart Click
fragment
First do three functions in two pieces

Android navigation drawer set clickable area only to list items

I am using a NavigationDrawer in my application and I am loading in the drawer a ListView. When the drawer is opened, it covers almost half of an Activity which contains also a ListView.
The problem that I face is that if I tap on the drawer(not on an item contained in the drawer), a ListView item from my Activity gets the click event and then starts an activity associated with that list item.
Is it possible to restrict the clickable area of the drawer only to the list items?
I assume your drawer layout is more complex than just a simple ListView, if you have place to tap on the drawer.
In that case, you could simple specify
android:clickable="true" for your top drawer layout (LinearLayout, RelativeLayout or whatever you use).

Using dropdown menus in tabs in Android

I'm a beginner in using Android. I'm trying to create an activity which contains 4 tabs (I'm using Google's SlidingTabLayout). One of the tabs is the "category" tab.
For this tab, I'm trying to have 5 options as a drop down menu. So I want the "category" tab to be selected by default and it shows 5 types and then when the user clicks one of the category types, a list view of corresponding category type will be shown.
In my opinion showing a drop down from one of the sliding tabs is a not a good and proper way.I think you should use Navigation Drawer for categories and the other corresponding category items should be shown in sliding tabs.Remove Category tab from sliding menu and show categories in Navigation Drawer and the corresponding sub categories should be in sliding tabs.That will be proper way and easy to manage.I think this will be a good idea.

How can I make a multi-level(more than 3 level) navigation drawer in android?

I am developing an android application where I need to put a navigation drawer which would have more than 3 levels.
What I want to do: If I click one item of my list in the drawer, a whole new list comes up in the drawer. This new list should also do the same when items of this list are clicked. This could go on for many levels.
What I have done till now: I am keeping an expandable list which expands when I click on any item. This design doesn't allow adding more levels.
Application which have similar drawers: svpply (please have a look at this application, it has a similar drawer)
I am a newbie in android development, try to add details to your ideas.
Thanks!
Have a single drawer keeping a FrameLayout.
Make all your list as ListFragment
Make Fragment Transaction on FrameLayout when a item is clicked.

Categories

Resources