Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Product implements Serializable{
- public int id;
- public String Name;
- public String description;
- public String longDescription;
- public String amount;
- public String image;
- }
- public class ProductPagerAdapter extends FragmentPagerAdapter {
- private Context context;
- private ArrayList<Product> list;
- public ProductPagerAdapter(FragmentManager fm, Context context, ArrayList<Product> list) {
- super(fm);
- this.context = context;
- this.list = list;
- }
- @Override
- public Fragment getItem(int position) {
- return ProductFragment.newInstance(position);
- }
- @Override
- public int getCount() {
- return list.size();
- }
- }
- public class ProductFragment extends Fragment {
- public ProductFragment() {
- // Required empty public constructor
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- View v = inflater.inflate(R.layout.fragment_product, container, false);
- //findViewById...
- return v;
- }
- public static Fragment newInstance(int id) {
- Bundle args = new Bundle();
- args.putInt("Id", id);
- ProductFragment fragment = new ProductFragment();
- fragment.setArguments(args);
- return fragment;
- }
- }
- lv_itemRateList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
- Intent intent = new Intent(getActivity(), DetailsActivity.class);
- Product r = new Product();
- r = rateListArrayList.get(i);
- intent.putExtra("product",r);
- startActivity(intent);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement