Monday, 19 August 2013

Multiple Fragments in android

Multiple Fragments in android

I have a fragment which inflates a layout which is having horizontal list
view and other views. I have 5 set of arraylist having images which will
be displayed in horizontal list view and i have to display them as 5 rows
in my activity like this ArrayList1{ Product Title Image1 Image2
.....(horizontal list view) } ArryList2{ Product Title Image1 Image2
.....(horizontal list view) } . .
this is my sample code
newFragment = SeasonalFragment.newInstance(3);
getFragmentManager()
.beginTransaction()
.add(newFragment,"Seasonalfragmentcategory2")
.show(newFragment)
.commit();
class SeasonalFragment extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
return
inflater.inflate(R.layout.seasonal_favorites_layout_contents,
container);
}
public static SeasonalFragment newInstance(int fragmentID) {
SeasonalFragment newFragment = new SeasonalFragment();
Bundle args = new Bundle();
args.putInt("FragmentID", fragmentID);
newFragment.setArguments(args);
return newFragment;
}
}
Only one row i am able to display.Please help

No comments:

Post a Comment