0

I know there are similar questions out there, but i could never understand the solution.

I want to pass on 4 drawables out of the local variables of my Activity:

public class MainActivity extends AppCompatActivity {

    private Drawable picture1;
    private Drawable picture2;
    private Drawable picture3;
    private Drawable picture4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void select(View view){
        SelectActivity temp = new SelectActivity();
        Intent i = new Intent(this, SelectActivity.class);
        //some Extras, that dont work because you can't send drawables
        startActivity(i);
    }
//...

Basically, I would like to just get the ID and put that in the extras or similar, because all the files are in my res folder. But those four pictures are pictures used in ImageButtons and when I click one of them I need all 4 pictures and an integer of which one was clicked (I already figured that out).

I'm new to Android stuff and I can't figure out how to do that. I'd appreciate a good explanation. Thank you in Advance

Neo
  • 1
  • 1
  • Does this answer your question? [How to pass drawable between activities](https://stackoverflow.com/questions/8407336/how-to-pass-drawable-between-activities) – Junaid Khalid Apr 03 '22 at 16:41
  • Try to convert `drawable` to `bitmap` then save the `bitmap` to the user device, and use the path you get it from the saved `bitmap` if you don't know the way to do it, I can help. – Mouaad Abdelghafour AITALI Apr 03 '22 at 21:57

0 Answers0