grid data change dynamically inside Fragment inside Sliding tab on click - android

I have a sliding tab layout where i have 3 tabs and a navigation drawer. Each tab is a fragment. now i want to use one fragment as a cardview in a grid manner. but my problem is when i click navigation drawer item my tab fragment grid data is not changing.
here is the link of my code structure.
https://github.com/rrrongon/NavigationDrawerwithTab

Use event bus for achieve this. when you click on menu item fire an event and than listen that event to your respective fragment and on listen do your respective work

Related

using nested fragments or changing tablayout adapter

i have this interface in my app
by choosing each item in bottomNavigation , the tab layout will change
my question is should i make a fragment for each of the bottom navigation items and then put the tab layouts inside that fragments ?
or make only one tab layout in activity and change the adapter of the tab layout in respond to selection of the bottom navigation items ?

How to pass click event from custom action bar to current page of android ViewPager?

I have an Activity with android.support.v4.view.ViewPager and custom ActionBar. There are three(0,1,2) pages in the ViewPager with page 1 set to be default page and user can slide left and right.
One Fragment class is used to show UI for each of the pages,which has a WebView which shows some html data which can be collapsed and viewed on a Button click in the WebView. Now there is also a button in the action, and I'm required to collapse and show these data on WebViewon the click of the Button in ActionBar. I've done it but the problem is that the items on the currently viewing page of ViewPager are not toggling on the click of the button in the actionbar, while that for the page on the left or right of it are working well.
How can I solve this problem?
What is the correct method of doing this?
You need to write 3 interfaces in 3 fragments.
You need to register this 3 fragments to you pager adapter/activity.
Whenever you click on the actionBar button check which is your
active/current page in the viewPager.
Perform click operation on the registered interface on the basis of
the active/current Page/Fragment.

Change current tab from a button click inside child fragment of the TabHost

I have currently a working project with Navigation drawer and tabbed view using TabHost.I have 3 tabs in which each fragments are loaded as the child view of the tab.My requirement is that,when I click a button inside the child fragment,I need to navigate to another tab.Is this possible?Any help is appreciated.
Im using TabHost,and the 3 tabs are each a fragment of themselves.
Again,Im not using a TabActivity...

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).

Android actionbar tabs + swipe view pager navigate from one tab to another dynamically

I have implemented android appcompat actionbar with swipeable tab views using viewpager. I have set two tabs (two fragments). On first fragment (First tab) , I have a button click listener. In this button click listener I need to show the second tab. Though I can swipe between the tabs, I want to call second tab on button click in first tab. How to achieve this?
Well, I found the solution.
On button click listener in first tab,
I set actionBar.setSelectedNavigationItem(1);
This takes me to the second tab :)

Categories

Resources