jeudi 30 juin 2016

Pass checked multiple images from one activity to another

I have a custom listview with checkbox imageview and textview and there is a button below listview. On clicking of that button i have to pass all the checked item details to another activity and show in other listview. I am able to pass selected value but not able to pass images. Images are in drawable folder. Please help me thanks.

Here is the code:

subscribe.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            String data = "";
            ArrayList<Item> stList = ((OurServiceAdapter) nAdapter)
              .getAllData();

            for (int i = 0; i < stList.size(); i++) {
                Item singleStudent = stList.get(i);
                if (singleStudent.isCheckbox() == true) {
                       name.add(singleStudent.getName().toString());
                       img.add(singleStudent.getImage());
                 data = data + "\n" + singleStudent.getName().toString();



                }

               }
              // byte[] imgs = singleStudent.getImage();
               Intent intent = new Intent(ActivityOurServices.this, ActivityServicesForm.class);
               intent.putStringArrayListExtra("key", name);
               //intent.putIntegerArrayListExtra("img", img);
               startActivity(intent);



        }
    });
}




Aucun commentaire:

Enregistrer un commentaire