Set ImageView Bitmap And Visibility - Android User Interface

Android examples for User Interface:ImageView

Description

Set ImageView Bitmap And Visibility

Demo Code


//package com.java2s;

import android.graphics.Bitmap;

import android.view.View;

import android.widget.ImageView;

public class Main {
    public static void SetBitmapAndVisibility(ImageView view, Bitmap bitmap) {
        SetBitmapAndVisibility(view, bitmap, View.GONE);
    }//from  w  w  w.j av  a 2 s.  com

    public static void SetBitmapAndVisibility(ImageView view,
            Bitmap bitmap, int visibilityIfEmpty) {
        if (bitmap == null) {
            view.setVisibility(visibilityIfEmpty);
        } else {
            view.setVisibility(View.VISIBLE);
            view.setImageBitmap(bitmap);
        }
    }
}

Related Tutorials