Before i begin,let me say that i've already checked all the links regarding this and the inflater init method doesn't work for me unfortunately
Fragment.java
public View onCreateView(LayoutInflater inflater1, ViewGroup container, Bundle savedInstanceState) {
View view = inflater1.inflate(R.layout.tab, container, false);
context = getActivity();
findViews(view);
setBar();
setPie();
return view;//inflater1.inflate(R.layout.tab, container, false);
}
private void findViews(View view) {
inflater=LayoutInflater.from(context);
root=(ViewGroup)view.findViewById(R.id.root);
piechart= (PieChart)view.findViewById(R.id.pie_chart);
barChart = (BarChart)view.findViewById(R.id.barchart);
popupContentView=inflater.inflate(popupdashboard,root,false);
Activity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard2);
//Initializing viewPager
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
tabLayout.setSelectedTabIndicatorColor(Color.MAGENTA);
//Adding the tabs using addTab() method
tabLayout.addTab(tabLayout.newTab().setText("Dashboard"));
tabLayout.addTab(tabLayout.newTab().setText("Transaction Details"));
tabLayout.addTab(tabLayout.newTab().setText("Your Tab Title2"));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
viewPager = (ViewPager) findViewById(R.id.simpleViewPager);
//Creating our pager adapter
pager adapter = new pager(getSupportFragmentManager(), tabLayout.getTabCount());
//Adding adapter to pager
viewPager.setAdapter(adapter);
/// if (tabLayout.getSelectedTabPosition()==0){
init = new Tab1();
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.linearLayout, init);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.commit();
Any help would be deeply appreciated