NikhilReddy
NikhilReddy

Reputation: 6954

How to add Image Dynamically android

I Am Having Base class which is called common activity,In that i am returning the String in every activity.By using the following code.

txtHeader = (TextView)findViewById(R.id.txtHeaderText);
        txtHeader.setText(getScreenHeader());

and i am returning the empty string

protected String getScreenHeader(){
        return "";
    }

In another activity i will do in this way.

public  final static String SCREEN_NAME = "Dashboard";
@Override
    protected String getScreenHeader() {
        return SCREEN_NAME;
    }

How can i do this For IMAGE-VIEW.

Sorry for my English.

Thansks, Nikhil.

Upvotes: 0

Views: 731

Answers (1)

James Cross
James Cross

Reputation: 7879

You will need to use a Bitmap object such as this:

 Bitmap b = getBitmapImage();
 ImageView img = (ImageView )findViewById(R.id.imgView);
 img.setImageBitmap(b);

Upvotes: 1

Related Questions