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 7487939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:41:43+00:00 2026-05-29T14:41:43+00:00

I’m using a GridView in my Android app. Everything works perfectly on my phone,

  • 0

I’m using a GridView in my Android app. Everything works perfectly on my phone, but when I tried to run the app on a tablet emulator, it crashed at the start.

The error is E/AndroidRuntime(466): java.lang.RuntimeException: Unable to start activity ComponentInfo{****/***.Main}: java.lang.RuntimeException: Unable to start activity ComponentInfo{***/***.views.calendar.CalendarView}: android.view.InflateException: Binary XML file line #42: Error inflating class android.widget.GridView
The line #42 has simply a <GridView> tag in it.

Then the stacktrace says Caused by: android.view.InflateException: Binary XML file line #42: Error inflating class android.widget.GridView, Caused by: java.lang.reflect.InvocationTargetException and finishes with:

02-11 23:57:17.079: E/AndroidRuntime(466): Caused by: android.content.res.Resources$NotFoundException: File  from drawable resource ID #0x1020004
02-11 23:57:17.079: E/AndroidRuntime(466):  at android.content.res.Resources.loadDrawable(Resources.java:1874)
02-11 23:57:17.079: E/AndroidRuntime(466):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-11 23:57:17.079: E/AndroidRuntime(466):  at android.widget.AbsListView.<init>(AbsListView.java:711)
02-11 23:57:17.079: E/AndroidRuntime(466):  at android.widget.GridView.<init>(GridView.java:76)
02-11 23:57:17.079: E/AndroidRuntime(466):  at android.widget.GridView.<init>(GridView.java:72)

I don’t use any LayoutParams, my xml layout looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/calendar_relativeLayout_main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <RelativeLayout
        android:id="@+id/calendar_relativeLayout_infoBar"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:background="@color/calendar_infoBar_background" >

        <ImageButton
            android:id="@+id/calendar_imageButton_previousMonth"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_alignParentLeft="true"
            android:background="@null"
            android:src="@drawable/ic_calendar_prev" />

        <ImageButton
            android:id="@+id/calendar_imageButton_nextMonth"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_alignParentRight="true"
            android:background="@null"
            android:src="@drawable/ic_calendar_next" />

        <TextView
            android:id="@+id/calendar_textView_currentMonth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:text="February 2012"
            android:textSize="17dp" />

    </RelativeLayout>

    <GridView
        android:id="@+id/calendar_gridView_currentCalendar"
        android:layout_width="fill_parent"
        android:layout_height="240dp"
        android:layout_below="@+id/calendar_relativeLayout_infoBar"
        android:numColumns="7"
        android:isScrollContainer="false"
        android:listSelector="@android:id/empty">
    </GridView>

</RelativeLayout>

What I don’t understand is that how come a GridView is workable on a phone and not workable in a tablet…

Thanks in advance for any clues…

  • 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-05-29T14:41:45+00:00Added an answer on May 29, 2026 at 2:41 pm
    android:listSelector="@android:id/empty"
    

    As far as I know the listSelector attribute expects a reference to a drawable, not an id. @android:id/empty can be used to declare an optional ’empty’ view for ListView and GridView, and I’m pretty sure it’s not meant to used as above. See ListActivity for more details. Try referencing an actual drawable (or color), e.g. @null or @android:color/transparent to make the selector ‘invisible’ (or just set the height to ‘0’).

    Alternatively, you could be using resource qualifiers that prevent a tablet from finding the appropriate resource. Have a read through the ‘How Android Finds the Best-matching Resource’ explanation for some more details. However, since you’re not referencing a drawable resource directly in your GridView declaration, I doubt this is the issue.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.