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

The Archive Base Latest Questions

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

I made a splash screen and used a runnable thread to parse a xml

  • 0

I made a splash screen and used a runnable thread to parse a xml file from server, but when I run this program , it just stuck at the splash screen, and I used a wifimanage to judge whether the device is connected to the Internet or not, if it is not, then skip the parsing and jump to the main activity.

here are some of my codes, would someone be so kind to check it out?

private static WifiManager mWifiManager;
    private static UpdateInfo info;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.loading);

        mWifiManager = (WifiManager)
                this.getSystemService(Context.WIFI_SERVICE);
    }
    public UpdateInfo getUpdateInfo(InputStream is) throws Exception{  
        if (mWifiManager.getWifiState()==WifiManager.WIFI_STATE_ENABLED){
        XmlPullParser  parser = Xml.newPullParser();    
        parser.setInput(is, "utf-8");//设置解析的数据源   
        int type = parser.getEventType();  
        info = new UpdateInfo();//实体  
        while(type != XmlPullParser.END_DOCUMENT ){  
            switch (type) {  
            case XmlPullParser.START_TAG:  
                if("version".equals(parser.getName())){  
                    info.setVersion(parser.nextText()); //获取版本号  
                }else if ("url".equals(parser.getName())){  
                    info.setUrl(parser.nextText()); //获取要升级的APK文件  
                }else if ("description".equals(parser.getName())){  
                    info.setDescription(parser.nextText()); //获取该文件的信息  
                }  
                break;  
            }  
            type = parser.next();  
        }  
        }else{
             Intent intent = new Intent ();
             intent.setClass(loading.this, monkeynote.class);
             startActivity(intent);
           }

        return info;  

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

    Your code only launches the activity if the loading fails. You need to move the intent creation outside of the else statement. Change your method to this:

    public UpdateInfo getUpdateInfo(InputStream is) throws Exception{  
      if (mWifiManager.getWifiState()==WifiManager.WIFI_STATE_ENABLED){
        XmlPullParser  parser = Xml.newPullParser();    
        parser.setInput(is, "utf-8");//设置解析的数据源   
        int type = parser.getEventType();  
        info = new UpdateInfo();//实体  
        while(type != XmlPullParser.END_DOCUMENT ){  
            switch (type) {  
            case XmlPullParser.START_TAG:  
                if("version".equals(parser.getName())){  
                    info.setVersion(parser.nextText()); //获取版本号  
                }else if ("url".equals(parser.getName())){  
                    info.setUrl(parser.nextText()); //获取要升级的APK文件  
                }else if ("description".equals(parser.getName())){  
                    info.setDescription(parser.nextText()); //获取该文件的信息  
                }  
                break;  
            }  
            type = parser.next();  
        }  
      }
      Intent intent = new Intent ();
      intent.setClass(loading.this, monkeynote.class);
      startActivity(intent);
    
    
      return info;  
    
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a program. I also made my own file type, which the program
Made a program retrieving .txt files from a folder. Each .txt files contains 1
Im writing a little python program that goes through an XML file and does
Made this nice little loop for hiding and showing div's, works as a charm
I made a class from Linq to SQL Clasees with VS 2008 SP1 Framework
I made a Java Applet with some Standard GUI Components on it. I used
I made a class that derives from Component: public class MyComponent: System.ComponentModel.Component { }
I made a code that translate strings to match each word from the array
I made an html file called test.html then I navigated to it as http://site.com/test.html?test1=a
Made a new project, added main.cpp and wrote the code at this URL: http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp

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.