Custom Array Adapter In Fragment
I am very new in Andriod. i have tried so many times but got stuck on this problem since long time. I have an activity named ProductListActivity and in this activity i have one fra
Solution 1:
Change
listOfProductsCategory = (ListView) getActivity().findViewById(R.id.productCategorylistView);
to
listOfProductsCategory = (ListView) fragProcatView .findViewById(R.id.productCategorylistView);
findViewById
looks for a view with the id in the current infalted layout. So use the view object to initialize your listview.
Edit:
You do something like this
static ProductCategoryFragment newInstance(int num) {
ProductCategoryFragmentf=newProductCategoryFragment();
// Supply num input as an argument.Bundleargs=newBundle();
args.putInt("num", num);
f.setArguments(args);
return f;
}
Then
int value = getArguments().getInt("num");
In Activity
ProductCategoryFragmentnewFragment= ProductCategoryFragment.newInstance(10);
Post a Comment for "Custom Array Adapter In Fragment"