w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Intent filter for receiving intents

ok let's assume you want to open an image from your own explorer create a new Activity let's say ImageActivity, then you simply implement an ImageViewer inside your activity and from the calling Activity simply send an intent with an Extra Bundle containing your image Bytes

EDIT

SENDING ACTIVITY

Intent intent = new Intent(MainActivity.this,
ImageActivity.class);
            ImageView imageView =  findViewById(R.id.image).getDrawable();
    imageView.buildDrawingCache();
    Bitmap image = imageView.getDrawingCache();
     Bundle extras = new Bundle();
    extras.putParcelable("imagebitmap", image);
    intent.putExtras(extras);
    startActivity(intent);

Receiving Activity ImageActivity

Bundle extras = getIntent().getExtras();
Bitmap bmp = (Bitmap) extras.getParcelable("imagebitmap");
                ImageView image =  findViewById(R.id.image);
image.setImageBitmap(bmp );




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.