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

  • SEARCH
  • Home
  • 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 7733987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:08:15+00:00 2026-06-01T07:08:15+00:00

Error – Market cannot be resolved or is not a field. News cannot be

  • 0

Error – Market cannot be resolved or is not a field.
News cannot be resolved or is not a field.
Weather cannot be resolved or is not a field.

I am trying an example on GridView. I added images named Market, News and Weather to res>>drawable-mdpi>> folder. But Eclipse fails to recognize it. The images are in *jpeg * format. What may be wrong? Can you please help? Here I am posting the code

public class MainActivity extends Activity 
{
    // Images to display-----------------------//
    Integer[] imageIds = {
            R.drawable.Market,
            R.drawable.News,
            R.drawable.Weather
    };
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        GridView gridView = (GridView) findViewById(R.id.gridview);// Bring gridView into context from main.xml
        gridView.setAdapter(new ImageAdapter(this)); 

        gridView.setOnItemClickListener(new OnItemClickListener()
        {
        public void onItemClick(AdapterView<?> parent,
        View v, int position, long id)
        {
            Toast.makeText(getBaseContext(), "pic " + (position + 1) + " selected",        Toast.LENGTH_SHORT).show();
        }
        });
     }

    public class ImageAdapter extends BaseAdapter
    {
        private Context context; // Context class object - context

        public ImageAdapter(Context c)
        {
            context = c;
        }

        //return number of images
        public int getCount()
        {
            return imageIds.length;
        }

        public Object getItem(int position)     // return type of getItem method is an Object
        {
            return position;
        }

        public long getItemId(int position)
        {
            return position;
        }

        //returns an ImageView view--------------
        public View getView(int position, View convertView, ViewGroup parent)
        {
            ImageView imageView;
            if(convertView == null)
            {
                imageView = new ImageView(context);
                imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
                imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                imageView.setPadding(5, 5, 5, 5);
            }
            else
            {
                imageView = (ImageView) convertView;
            }
            imageView.setImageResource(imageIds[position]);
            return imageView;
        }       
    }    
}
  • 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-01T07:08:17+00:00Added an answer on June 1, 2026 at 7:08 am

    I tried creating a resource with name Weather (a picture placed in drawable-mdpi) and I got

    res\drawable-mdpi\Weather.jpg: Invalid file name: must contain only
    [a-z0-9_.]

    in Eclipse. I thought the resource names should be snake-styled by restriction, but I found this thread where the guy states that camel case is also all right. This means that the only restriction is not to have the first letter capital.

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

Sidebar

Related Questions

Error: End tag for 'optgroup' which is not finished. You have probably failed to
Error % javac StringTest.java StringTest.java:4: variable errorSoon might not have been initialized errorSoon[0] =
error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : >could not deduce template argument
error CS0266: Cannot implicitly convert type 'object' to 'int'. An explicit conversion exists (are
Error: Could not load System.Data.SqlServerCe.Entity.dll. Reinstall SQL Server Compact. Inner Exception: {Could not load
Error Details: The Web application at http://dev001aaamaaind:333/ could not be found. Verify that you
Error: Database table users for model User was not found. I'm expriencing the error
Error on the following GridView xml Multiple annotations found at this line: - error:
Error: One or more models did not validate: maps.parking: 'layer_id' has a relation with
Error in NSLog: *** -[NSThread initWithTarget:selector:object:]: target does not implement selector (*** -[Document myTcpClient])

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.