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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:20:03+00:00 2026-06-18T01:20:03+00:00

I am new to Android software development and new to this site. I hope

  • 0

I am new to Android software development and new to this site. I hope someone can help.

My Android Application cant able to display XML parsed data into ListView.. Its displaying Toast message only.

Help me, Your help would be appreciated.

My Code Is : .java

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ll = (LinearLayout) findViewById(R.id.layout);



        ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

        NetworkInfo ni = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

        if(ni.isAvailable())
        {
            if(!(ni.isConnected()))
            {
                Toast.makeText(getApplicationContext(), "No WIFI Connected...", Toast.LENGTH_LONG).show();
            }
        }
        else
        {
            /*ni = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

            if(ni.isAvailable())
            {
                if(ni.isConnected())
                {

                }
            }*/

            b = (Button) findViewById(R.id.button1);

            //intent = new Intent(getApplicationContext(), display.class);


            b.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub



                    ed1 = (EditText) findViewById(R.id.what);
                    ed2 = (EditText) findViewById(R.id.where);

                    String what = ed1.getText().toString();
                    String where = ed2.getText().toString();


                    if(what.equals("") || where.equals(""))
                    {
                        Toast.makeText(getApplicationContext(), "Please, Enter Some Missing Value.", Toast.LENGTH_LONG).show();
                    }
                    else
                    {
                        Toast.makeText(getApplicationContext(),"Wait... Searching.....", Toast.LENGTH_LONG).show();

                        try {

                            URL text = new URL("My_URL");

                            XmlPullParserFactory xppf=XmlPullParserFactory.newInstance();

                            XmlPullParser xpp=xppf.newPullParser();

                            xpp.setInput(text.openStream(),null);

                            int pe =xpp.getEventType();
                            boolean status=false;


                            while(pe!=XmlPullParser.END_DOCUMENT)
                            {
                                switch(pe)
                                {
                                case XmlPullParser.START_TAG:

                                    String tag=xpp.getName();
                                    if(tag.equals("status"))
                                    {
                                        status=true;
                                    }
                                    if(tag.equals("name"))
                                    {
                                        nameTag=true;
                                    }
                                    if(tag.equals("formatted_address"))
                                    {
                                        addTag=true;
                                    }
                                    break;

                                case XmlPullParser.TEXT:
                                    String value;
                                    if(status==true)
                                    {
                                        value=xpp.getText();
                                        if(value.equals("ZERO_RESULTS"))
                                        {
                                            Toast.makeText(getApplicationContext(), "No Results Found for "+ed1.getText().toString(), Toast.LENGTH_LONG).show();
                                        }
                                    }
                                    if(nameTag==true)
                                    {
                                        value=xpp.getText();
                                        newName.add(value);
                                    }
                                    if(addTag==true)
                                    {
                                        value=xpp.getText();
                                        newAdd.add(value);
                                    }

                                    break;
                                case XmlPullParser.END_TAG:
                                    String txt=xpp.getName();

                                    if(txt.equals("name"))
                                    {
                                        nameTag=false;
                                    }
                                    if(txt.equals("formatted_address"))
                                    {
                                        addTag=false;
                                    }
                                    break;

                                }//end switch

                                pe=xpp.next();
                            }//end while

                            //ArrayList to String[] for name
                            String name[] = new String[newName.size()];

                            name = newName.toArray(name);

                            //ArrayList to String[] for Address
                            String add[] = new String[newAdd.size()];

                            add = newAdd.toArray(add);

                            Intent i = new Intent(getApplicationContext(), List.class);
                            i.putExtra("nameTag", name);
                            i.putExtra("addTag", add);

                            startActivity(i);

                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();

                        }
                    }//else
                }//onClick
            });//listener
        }//else
    }
}

XML file:

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent" android:id="@+id/linear">

   <ListView 
    android:layout_height="wrap_content" 
    android:id="@+id/listview1" 
    android:layout_width="fill_parent"/> 

</LinearLayout>
  • 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-18T01:20:04+00:00Added an answer on June 18, 2026 at 1:20 am

    when I was learning parsing xml and displaying it in ListView this tutorial helped me a lot, take a look:
    http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/

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

Sidebar

Related Questions

I am new to Android development using eclipse, although not new to software development
I am new to Android and Eclipse development, but not new to software development
I am new to Android and Eclipse development, but not new to software development
I am new to Android development using eclipse, although not new to software development
I'm new in Android development and I need some help coming with a solution
I went to Help>install new software. I was able to install the ADT plugins.
i am creating a new android application.i am using the table layout. I have
I am relatively a new Android developer and I am not able to understand
When I start a new Android project in Eclipse (Helios), the strings.xml has 2
I'm trying to record audio this.recorder = new android.media.MediaRecorder(); this.recorder.setAudioSource(android.media.MediaRecorder.AudioSource.MIC); this.recorder.setOutputFormat(android.media.MediaRecorder.OutputFormat.DEFAULT); this.recorder.setAudioEncoder(android.media.MediaRecorder.AudioEncoder.DEFAULT); this.recorder.setOutputFile(pruebaAudioRecorder.mp4); **this.recorder.prepare();**

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.