s_mani90
s_mani90

Reputation: 67

image not showing in activity file when declaring it

I am creating a app using image switcher.I have copied some images to res/drawable-mdpi folder when trying to declare it its not showing in drawable.

Integer pics[]={R.drawable.}

and even image switcher not showing

final ImageSwitcher iswitcher=(ImageSwitcher)findViewById(R.id.);

Upvotes: 2

Views: 97

Answers (2)

Bhoomika Brahmbhatt
Bhoomika Brahmbhatt

Reputation: 7415

First check your R file in gen folder.

It contains drawable field like this

public static final class drawable {
        public static final int ic_launcher=0x7f020000;
    }

check your image name in this.

If it is not containing then please check your All layout(xml) files. whether is it ok or not. sometimes incorrect xml file will occure errors in R.java file .

If all layouts are ok then check your image name. uppercase is not allowed for resource names.. only lowercase(a-z), 0-9, .(dot) and _ are valid.

Then Clean your project.

If all thing is perfect then Restart your eclipse then clean & build your project.

Upvotes: 1

Piyush
Piyush

Reputation: 18923

There are two possibilities:

1) Your image name may be started with First alphabet which is not allowed in Android.

2) Sometimes in Eclipse this types of problems occurs so try to rebuild your project. for that Go to Project->Clean->Run.

Hope you will get this:

Upvotes: 3

Related Questions