Skip to content Skip to sidebar Skip to footer

I Need To Intent Imageview Resource File That Is Originally Passed From Another Activity

codes for filling the imageview onClick event on the main activity if (view.equals(findViewById(R.id.madrid_imageButton))) { Bitmap madridImage = BitmapFactory.decodeRe

Solution 1:

based on the brainstorming done during the above questions and comments i came up with the below idea and it actually solved the issue :)

public void onClickAddToCart(View view) {
        // Here is i concatenated three textViews values - calculations into one single string 
        // to pass it to the Cart activity
        TextView orderDetailsTextView1 = (TextView) findViewById(R.id.productName_textView);
        TextView orderDetailsTextView2 = (TextView) findViewById(R.id.totalItems_textView);
        TextView orderDetailsTextView3 = (TextView) findViewById(R.id.totalCost_textView);
        String orderDetailsTextView = orderDetailsTextView1.getText().toString();
        orderDetailsTextView +=   "  " +  orderDetailsTextView2.getText().toString();
        orderDetailsTextView +=  "  :  " + orderDetailsTextView3.getText().toString();

        // in the below declaration i saved the originally intent image source to a variable 
        // and her i recall it to re-intent it again
        Bundle extras = getIntent().getExtras();
        Bitmap productImage = (Bitmap)this.getIntent().getParcelableExtra("Bitmap");

        // Here is the passing method - transfering below data from this activity to the Cart activity
        Intent buyProduct_Intent = new Intent(MainActivityBuy.this, Cart.class);
        buyProduct_Intent.putExtra("OrderDetails", orderDetailsTextView);
        buyProduct_Intent.putExtra("Bitmap", productImage);
        startActivity(buyProduct_Intent);
    }

Post a Comment for "I Need To Intent Imageview Resource File That Is Originally Passed From Another Activity"