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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:09:16+00:00 2026-05-31T09:09:16+00:00

Hi so what im trying to do is when the player loses the game

  • 0

Hi so what im trying to do is when the player loses the game a highscore list comes up taking up half the screen in the form of a listView. Im trying to work with a listview object inflated from my xml im not sure how to do this though.

I have tried:

LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

ListView lv = (ListView) inflater.inflate(R.id.highscores,null);

but it keeps telling me lv is null

heres my xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<com.SpaceShot.single android:id="@+id/single1"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content">

 </com.SpaceShot.single>

<ListView android:id="@+id/highScores"
 android:layout_width="wrap_content"
 android:layout_height="200dp"
 android:padding="15dp"
 android:visibility= "invisible"
 >
</ListView>
</FrameLayout>

EDIT:

Now inflating the ListView works but i get this error:

03-15 23:05:01.351: ERROR/AndroidRuntime(2555): Uncaught handler: thread Thread-11 
exiting due to uncaught exception
03-15 23:05:01.371: ERROR/AndroidRuntime(2555): android.view.InflateException: Binary
 XML file line #9: Error inflating class java.lang.reflect.Constructor
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
android.view.LayoutInflater.createView(LayoutInflater.java:512)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
android.view.LayoutInflater.inflate(LayoutInflater.java:407)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at
android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
com.SpaceShot.single$singleThread.doDraw(single.java:503)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
com.SpaceShot.single$singleThread.run(single.java:1754)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555): 
Caused by: 
java.lang.reflect.InvocationTargetException
03-15 23:05:01.371: ERROR/AndroidRuntime(2555): at com.SpaceShot.single.<init>
(single.java:1922)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):  at 
java.lang.reflect.Constructor.constructNative(Native Method)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at     
java.lang.reflect.Constructor.newInstance(Constructor.java:446)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at 
android.view.LayoutInflater.createView(LayoutInflater.java:499)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     ... 7 more
03-15 23:05:01.371: ERROR/AndroidRuntime(2555): 
Caused by: java.lang.RuntimeException:
Can't create handler inside thread that has not called Looper.prepare()
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at android.os.Handler.<init>
(Handler.java:121)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at android.view.SurfaceView$1.
<init>(SurfaceView.java:107)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     at android.view.SurfaceView.<init>
(SurfaceView.java:105)
03-15 23:05:01.371: ERROR/AndroidRuntime(2555):     ... 11 more
  • 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-31T09:09:18+00:00Added an answer on May 31, 2026 at 9:09 am

    LayoutInflater is used to inflate a layout , so you need to do the following to get the correct result:

    LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    
    View layout = (View)inflater.inflate(R.layout.your_layout,null);
    
    ListView v = (ListView)layout.findViewById(R.id.highscores);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the youtube as3 chromeless player to work. I have followed
I am trying to get an embedded video player to work in facebook. When
While trying to integrate Yahoo Media Player into my own website, I want to
I'm trying to the the flv Flash player from here in a windows forms
I am trying to load a flash player onto an html page. The page
I'm trying to implement the Media Player custom field control described in this MSDN
I'm trying to create a player who can add and remove items from their
Hi i am trying to build an FM player for cyanogen mod. I got
I am trying to develop a custom movie player in iPhone using AVPlayer. But
I've been trying to create a Windows Media Player plugin in Visual Studio 2008,

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.