Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9213437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:44:58+00:00 2026-06-18T01:44:58+00:00

I thought the book had incorrect code. Tried at my home location and it

  • 0

I thought the book had incorrect code. Tried at my home location and it worked. Found out that my eclipse was actually broken. Had to remove and re install eclipse.

This is my first post here so if I didn’t follow some of the rules please let me know.
I tried to search and found a few post with the same error but they dealt with strings.
I’m following Android Apps for Absolute Beginners (2nd Edition) and on page 179 you bring button1.xml into your res/drawable. When I go in layout/activity_main.xml and input

<ImageButton 
    android:id="@+id/button_one"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/button1"
    android:contentDescription="@string/app_name"/>

It errors stating that the android:src “error: Error: No resource found that matches the given name (at ‘src’ with value ‘@drawable/button1’).”

Now there’s a few things confusing me, I’m using eclipse and I have 4 drawable folders (drawable-hdpi,drawable-ldpi, drawable-mdpi, and drawable-xhdpi), I’ve went to New>File on each of the 4 drawable folders and imported a button1_focused.png, button1_pressed.png, and button1_normal.png with their respective resolutions. I’ve also put button1.xml in each of the folders.

button1.xml is as follows

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
            android:drawable="@drawable/button1_pressed" />
    <item android:state_focused="true"
            android:drawable="@drawable/button1_focused" />
    <item android:drawable="@drawable/button1_normal" />
</selector>

I tried android:background instead of android:src and that errors out as well. I see that its error’ing out stating that there is no file at src (or background). Just not sure what to put there.

Java Code
package com.example.ui_designs;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

ImageButton imageButton = new ImageButton(context);
imageButton.setImageResource(R.drawable.button1);

}

Link to the screenshot: http://s7.postimage.org/3v4tu9ifv/UI_Designs.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:45:00+00:00Added an answer on June 18, 2026 at 1:45 am

    I thought the book had incorrect code. Tried at my home location and it worked. Found out that my eclipse was actually broken. Had to remove and re install eclipse.

    I apologize for any inconvenience I may had caused and appreciate the community for the assistance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought I had resolved this but I obviously haven't and was hoping someone
I thought I would be smart and create member functions that accepted output iterators.
I thought this would be fairly simple but it turns out not to work
I was under the impression that we had to declare - public $name =
Note: NOT Javascript. :-) Hello, I just had a random thought, and have decided
Every single book that teaches programming (or almost anything else) starts off with a
In his book The C++ Standard Library (Second Edition) Nicolai Josuttis states that lambdas
So, I'm learning Objective C by this book. It is thought to be great
I've been reading through the book Working Effectively with Legacy Code and I've been
I need to model an idea which can be broken down and thought of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.