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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:49:51+00:00 2026-06-09T14:49:51+00:00

I have checked this link and implemented the following but i am still getting

  • 0

I have checked this link and implemented the following but i am still getting error
ProgressDialog : how to prevent Leaked Window

Here is my code

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

    private ProgressDialog progress;
    public MyClass(ProgressDialog progress)
    {
        this.progress = progress;
    }
    public void onPreExecute()
    {

        progress.show();
    }
    protected Void doInBackground(Void... params) {
        try {               
            /**
             * Create a new instance of the SAX parser
             **/
            SAXParserFactory saxPF = SAXParserFactory.newInstance();
            SAXParser saxP = saxPF.newSAXParser();
            XMLReader xmlR = saxP.getXMLReader();
            URL url = new URL("http://zaggle.foostor.in/xml/get_product_by_id/"+((MyApplication) getApplicationContext()).categoryid); // URL of the XML        
            /** 
             * Create the Handler to handle each of the XML tags. 
             **/
            XMLHandlerforDetailsofproduct myXMLHandler = new XMLHandlerforDetailsofproduct();
            xmlR.setContentHandler(myXMLHandler);
            xmlR.parse(new InputSource(url.openStream()));              
        } catch (Exception e) {
            System.out.println(e);
        }
        data = XMLHandlerforDetailsofproduct.data;
        for (int i = 0; i < data.getdenominationsvalue().size(); i++) {

            denomvalue.add(data.getdenominationsvalue().get(i));
            denomid.add(data.getdenominationsid().get(i));
            disc.add(data.getdiscount().get(i));
            stock.add(data.getstock().get(i));

        }           



        return null;            
    }

    public void onPostExecute(Void unused)
    {

        this.progress.dismiss();
        this.progress = null;

    }       

}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.store_denomination);
    spin1 = (Spinner)findViewById(R.id.spin);   
    ProgressDialog progress = new ProgressDialog(this);
    progress.setMessage("Loading......");
    new MyClass(progress).execute();
            ---------------------------------

and the code continues
}

Here is my logcat:

08-10 10:36:19.500: E/WindowManager(835): Activity com.androidhive.xmlparsing.Detailsofproduct has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f15250 that was originally added here
08-10 10:36:19.500: E/WindowManager(835): android.view.WindowLeaked: Activity com.androidhive.xmlparsing.Detailsofproduct has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f15250 that was originally added here
08-10 10:36:19.500: E/WindowManager(835):   at android.view.ViewRoot.<init>(ViewRoot.java:247)
08-10 10:36:19.500: E/WindowManager(835):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
08-10 10:36:19.500: E/WindowManager(835):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
08-10 10:36:19.500: E/WindowManager(835):   at android.view.Window$LocalWindowManager.addView(Window.java:424)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.Dialog.show(Dialog.java:241)
08-10 10:36:19.500: E/WindowManager(835):   at com.androidhive.xmlparsing.Detailsofproduct$MyClass.onPreExecute(Detailsofproduct.java:75)
08-10 10:36:19.500: E/WindowManager(835):   at android.os.AsyncTask.execute(AsyncTask.java:391)
08-10 10:36:19.500: E/WindowManager(835):   at com.androidhive.xmlparsing.Detailsofproduct.onCreate(Detailsofproduct.java:127)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-10 10:36:19.500: E/WindowManager(835):   at android.os.Handler.dispatchMessage(Handler.java:99)
08-10 10:36:19.500: E/WindowManager(835):   at android.os.Looper.loop(Looper.java:123)
08-10 10:36:19.500: E/WindowManager(835):   at android.app.ActivityThread.main(ActivityThread.java:4627)
08-10 10:36:19.500: E/WindowManager(835):   at java.lang.reflect.Method.invokeNative(Native Method)
08-10 10:36:19.500: E/WindowManager(835):   at java.lang.reflect.Method.invoke(Method.java:521)
08-10 10:36:19.500: E/WindowManager(835):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-10 10:36:19.500: E/WindowManager(835):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-10 10:36:19.500: E/WindowManager(835):   at dalvik.system.NativeStart.main(Native Method)

Can anyone suggest where am doing something wrong??

  • 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-09T14:49:52+00:00Added an answer on June 9, 2026 at 2:49 pm

    I think this may be your solution

    Firstly remove your constructor and Progress dialog instance create in the preExcecute methos like this

    protected void onPreExecute() {
                    dialog=new ProgressDialog(Activity.this);
                    dialog.show();
                    super.onPreExecute();
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have checked this similar question, but the suggestions did not solve my problem:
I have the following code: function toggleChecked(status) { $(.checkbox).each( function() { $(this).attr(checked,status); }) }
I have checked many questions here but none has my answer. I appreciate if
i have implemented twitter bootstraps Tooltip before. But this time when I did it,
I have used the code from apples example from this page: Link , but
This is my current scenario: I have checked in my grails app code +
I have a 2884765579 bytes file. This is double checked with this function, that
I have this code in JS: if($('.log input:checked')) { alert('login checked'); alert('do what you
I have this js code: $(#startSearch).live(click, function(event) { $(input:checkbox[name='searchId']:checked).each(function() { var searchId = $(this).val();
I've checked through other questions and surprisingly this question doesn't seem to have been

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.