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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:11:56+00:00 2026-06-10T05:11:56+00:00

Hello I am trying to create an ASyncTask that will parse data from an

  • 0

Hello I am trying to create an ASyncTask that will parse data from an XML file in the background and then display that String array data in a ListView. I am not understanding what I am doing wrong so far, or how to return the String Array values back to my GUI. Here is the code for what I have so far with it if you need anything else let me know please. Thank you for looking and giving any suggestions or places to turn to to find out more.

package com.lvlup.kikurself.scotttest;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import android.app.ListActivity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import java.io.IOException;
import org.xml.sax.SAXException;

//import com.lvlup.kikurself.scotttest.WikiParser.Cm;

public class scottPlayers extends ListActivity {

public class PlayerGet extends AsyncTask<Void, Void, Void>{


@Override
protected void onPostExecute(Void result){

WikiParser p = new WikiParser();
ArrayList<String> titles = new ArrayList<String>();

try {
    p.parseInto(new URL("http://scottlandminecraft.wikia.com/api.php?action=query&list=categorymembers&cmtitle=Category:Players&cmlimit=500&format=xml"), titles);

} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (SAXException e) {}

    //String[] values = new String[50]; 
    //values = res;




    ArrayAdapter<String> adapter = new ArrayAdapter<String>(scottPlayers.this, R.layout.main, titles);

    setListAdapter(adapter);

    //final ListView playersList = getListView();


    /*playersList.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent, View v, int position, long thisID)
    {
         Object o = (playersList.getItemAtPosition(position));
         String playerName_temp = (o.toString());

         Intent newIntent = new Intent(v.getContext(), playerDisp.class);
         newIntent.putExtra("tempN", playerName_temp);
         startActivity(newIntent);

    }
    });*/

}

 @Override
 protected void onPreExecute() {
  // TODO Auto-generated method stub
  Toast.makeText(scottPlayers.this,
    "onPreExecute \n: preload bitmap in AsyncTask",
    Toast.LENGTH_LONG).show();
 }


 @Override
 protected Void doInBackground(Void... params) {
  // TODO Auto-generated method stub

  return null;
 }


}


@Override
public void onCreate(Bundle icicle) {
 super.onCreate(icicle);

 setContentView(R.layout.main);

 new PlayerGet().execute();
}


    //get your data back again with: String fName = getIntent().getExtras().getInt("fname");




}

EDIT: I added new code after looking at other examples this is what I have come up with but now when I run this in the Emulator it just shows the background of my Main.xml the list doesn’t populate, and if I import this to my phone running ICS it says that there was an error and force closes…I couldn’t get this to happen in the emulator for some reason, and there were no errors in the LogCat for the emulator.

  • 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-10T05:11:57+00:00Added an answer on June 10, 2026 at 5:11 am

    Please get into the habit of reading the documentation before you ask for help. Everything you need is here.

    Specifically, you need to implement onPostExecute in your PlayerGet class. It will be called when the background task has finished and will return the ArrayList to you as an argument to the callback.

    A couple of helpful tips also. Always follow the standard Java naming conventions. Your class name “scottPlayers” should start with an uppercase letter. Also try to avoid using Object unless absolutely necessary. Type casting and type checking will save you a world of pain later on.

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

Sidebar

Related Questions

hello everyone im trying to create this tweak that copies a file from one
Hello there i'm trying to create a form with Zend_Form that will enable my
I'm trying to create a textmate snippet that will transform this: HELLO WORLD<br />
I'm trying to create a function that will take a string which could be
Im trying to create a HTML table with links from a XML file using
Hello, i'm trying to take detailed information from the database, i create a simple
Hello I was trying to remove objects from object array that I have and
**Hello, I'm trying to create an archiver in java. This means that I am
I'm trying to create a MySQL statement that will sort by a value calculated
Hello I am trying to create a for loop that loops through the linked

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.