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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:19:43+00:00 2026-05-22T20:19:43+00:00

UPDATE: So I tried the AssetManager way and ended up with this: … …

  • 0

UPDATE:

So I tried the AssetManager way and ended up with this:

...
...
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser xrp = factory.newPullParser();

AssetManager assmgr = context.getAssets();

xrp.setInput(assmgr.open("levels/level_1.xml"), null);

//Object attributes
String type = null;
int x = 0;
int y = 0;
double angleRads = 0;

int eventType = xrp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
    if (eventType == XmlPullParser.START_DOCUMENT) {
    } else if (eventType == XmlPullParser.START_TAG) {
        if (xrp.getName().equals("Position")) {
            while (!xrp.getName().equals("X")) {  <----NULLPOINTER EXCEPTION HERE
                eventType = xrp.next();
            }           
...
...

Now this code used to work fine when xrp was a XmlResourceParser but now I get this error message:

06-01 05:13:56.797: ERROR/AndroidRuntime(946): Caused by: java.lang.NullPointerException
06-01 05:13:56.797: ERROR/AndroidRuntime(946):     at com.stickfigs.blockball.BlockBallView$BlockBallThread.initLevel(BlockBallView.java:342)

I don’t understand why this isn’t working anymore, I marked the line where the nullpointerexception is happening in the code above with an arrow.

=== vvvOLDvvv ===

In my res/xml/ folder I have a bunch of files called level_#.xml (ex: level_1.xml, level_2.xml, level_21.xml) and I have a spinner widget that I want to populate with the id names of all of the .xml files in this folder that follow the naming convention level_#.xml and only those.

I think I figured out how to set up the widget:

Spinner lsSpinner = (Spinner) findViewById(R.id.levelselect_spinner);

String levels[] = {"level_1","level_2","level_55"};

ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, levels);
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
lsSpinner.setAdapter(spinnerArrayAdapter);

Now I just need to generate levels[] dynamically like I explained before…

How do I go about doing this?

  • 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-22T20:19:44+00:00Added an answer on May 22, 2026 at 8:19 pm

    Have a look at AssetManager: http://developer.android.com/reference/android/content/res/AssetManager.html#list(java.lang.String)

    And then you can new a file and getName()
    Link: http://developer.android.com/reference/java/io/File.html#getName()

    Hope this helps.

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

Sidebar

Related Questions

Update: Tried November CTP release. Same error message. Forgot to mention that this server
This question reflects my issue. How to do this in SQLite? I've tried UPDATE
UPDATE: I tried implementing the method specified by Peter and am getting incorrect shadowing.
UPDATE I tried using the internal wordpress rewrite. What I have to do is
One update: I tried using the SummaryRow on the datagrid for its basic functionalities
Is it possible to update first row and with WHERE clause. I Tried: UPDATE
I tried to update some part of a matrix, I got the following error
I tried to update an fullcalendar event with updateEvent but only the first time
UPDATE: I also tried implementing UITextViewDelegate delegate and then doing in my controller: -
Our proxy went down and I tried to update dependencies with Maven while it

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.