get ImageView's image and send it to an activity with Intent

前端 未结 7 1517
孤街浪徒
孤街浪徒 2020-12-06 03:22

I have a grid of many products in my app. when the user selects one of the item in the grid, I am starting a new activity as DIALOG box and display the item\'s name,quantity

7条回答
  •  太阳男子
    2020-12-06 04:09

    first you'll have to save your image first and then you can use this method to send the file name of your saved image

        void Send() { 
                if (file != null) {
                Intent intent = new Intent(this, Draw.class);
                intent.putExtra(PICTURE_FILE_ID, file);
                startActivity(intent);
            } else if (file == null) {
                Toast tst = Toast.makeText(getApplication(),
                        "Please Click Save First", Toast.LENGTH_SHORT);
                tst.setGravity(Gravity.CENTER, 0, 0);
                tst.show();
            }
    }
    

    the other activity

    use mBitmapFile = (File) getIntent().getSerializableExtra( YourClassName.PICTURE_FILE_ID);

提交回复
热议问题