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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:28:36+00:00 2026-06-15T23:28:36+00:00

I am working on an application in which I have used fragments. On calling

  • 0

I am working on an application in which I have used fragments. On calling web service on thread application crashes.
When Orientation changes, logs shows below exception in red color:

12-14 14:36:51.770: E/WindowManager(5270): Activity com.weg.ecatalogfragment.ECatalogFragmentActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41457e20 that was originally added here
12-14 14:36:51.770: E/WindowManager(5270): android.view.WindowLeaked: Activity com.weg.ecatalogfragment.ECatalogFragmentActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41457e20 that was originally added here
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:345)
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:268)
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:216)
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:141)
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.Window$LocalWindowManager.addView(Window.java:537)
12-14 14:36:51.770: E/WindowManager(5270):  at android.app.Dialog.show(Dialog.java:278)
12-14 14:36:51.770: E/WindowManager(5270):  at android.app.ProgressDialog.show(ProgressDialog.java:117)
12-14 14:36:51.770: E/WindowManager(5270):  at android.app.ProgressDialog.show(ProgressDialog.java:100)
12-14 14:36:51.770: E/WindowManager(5270):  at android.app.ProgressDialog.show(ProgressDialog.java:95)
12-14 14:36:51.770: E/WindowManager(5270):  at com.weg.ecatalogfragment.HomeScreen.syncWithServer(HomeScreen.java:416)
12-14 14:36:51.770: E/WindowManager(5270):  at com.weg.ecatalogfragment.HomeScreen.onClick(HomeScreen.java:622)
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.View.performClick(View.java:3528)
12-14 14:36:51.770: E/WindowManager(5270):  at android.view.View$PerformClick.run(View.java:14235)
12-14 14:36:51.770: E/WindowManager(5270):  at android.os.Handler.handleCallback(Handler.java:605)
12-14 14:36:51.770: E/WindowManager(5270):  at android.os.Handler.dispatchMessage(Handler.java:92)
12-14 14:36:51.770: E/WindowManager(5270):  at android.os.Looper.loop(Looper.java:137)
12-14 14:36:51.770: E/WindowManager(5270):  at android.app.ActivityThread.main(ActivityThread.java:4424)
12-14 14:36:51.770: E/WindowManager(5270):  at java.lang.reflect.Method.invokeNative(Native Method)
12-14 14:36:51.770: E/WindowManager(5270):  at java.lang.reflect.Method.invoke(Method.java:511)
12-14 14:36:51.770: E/WindowManager(5270):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
12-14 14:36:51.770: E/WindowManager(5270):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
12-14 14:36:51.770: E/WindowManager(5270):  at dalvik.system.NativeStart.main(Native Method)

After this Activity is called again and due to flow of code, context fails to appear at alert box and application crashes.

12-14 14:37:16.950: E/AndroidRuntime(5270): FATAL EXCEPTION: main
12-14 14:37:16.950: E/AndroidRuntime(5270): java.lang.NullPointerException
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.AlertDialog.resolveDialogTheme(AlertDialog.java:142)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.AlertDialog.<init>(AlertDialog.java:98)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.ProgressDialog.<init>(ProgressDialog.java:78)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.ProgressDialog.show(ProgressDialog.java:111)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.ProgressDialog.show(ProgressDialog.java:100)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.ProgressDialog.show(ProgressDialog.java:95)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at com.weg.ecatalogfragment.HomeScreen$1.dispatchMessage(HomeScreen.java:141)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.os.Looper.loop(Looper.java:137)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at android.app.ActivityThread.main(ActivityThread.java:4424)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at java.lang.reflect.Method.invokeNative(Native Method)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at java.lang.reflect.Method.invoke(Method.java:511)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
12-14 14:37:16.950: E/AndroidRuntime(5270):     at dalvik.system.NativeStart.main(Native Method)

Either it should not call to the Activity again or the flow should stop at the moment.

Please suggest me in case of this fragment use, what should I do to handle my webservices.
Below is my code:

public class HomeScreen extends Fragment implements OnClickListener,OnItemSelectedListener,IServerResponse
{

    private Handler _handler = new Handler() {
        public void dispatchMessage(Message msg) {
            switch (msg.arg2) {
            case Constant.PID_GETUPDATEDATA:
                final ProgressDialog progressDialog = ProgressDialog.show(HomeScreen.this.getActivity(),"", Constant.MSG_SYNC);
                final String msgData = (String) msg.obj;
                new Thread(new Runnable() {
                    public void run() {
                        Looper.prepare();
                        try{
                            if (msgData.equalsIgnoreCase("We apologize, no data was found.")) {

                                HomeScreen.this.getActivity().runOnUiThread(new Runnable() {
                                    public void run() {
                                        Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR,
                                                Constant.MSG_NOUPDATE, HomeScreen.this.getActivity(), false);       
                                    }
                                });

                            }else{
                                JSONObject jsonObject=new JSONObject(msgData);
                                JSONObject electricObject = jsonObject.getJSONObject("NewDataSet");
                                JSONArray electricDBArray=electricObject.getJSONArray("Electrical_DB");

                                int count=electricDBArray.length();

                                String PrivousDateTime=myPref.getString("PREVIOUS_DATETIME", "");
                                if(PrivousDateTime.equals("")||PrivousDateTime==null)
                                {                                                   
                                    _eCatalogueTable.deleteTable(ECatalogueDatabase.DATABASE_TABLE);
                                }

                                for(int j=0;j<count;j++)
                                {
                                    String productLineID=electricDBArray.getJSONObject(j).getString("id");
                                    String productLine=electricDBArray.getJSONObject(j).getString("productline");
                                    String hp = electricDBArray.getJSONObject(j).getString("outputhp");
                                    String rpm = electricDBArray.getJSONObject(j).getString("rpm");
                                    String voltage = electricDBArray.getJSONObject(j).getString("voltage");
                                    String frame = electricDBArray.getJSONObject(j).getString("frame");
                                    if(!isProductIDPresentInDb(productLineID))
                                    {                           
                                        _eCatalogueTable.InsertECatalogue(productLineID,productLine,hp, rpm, voltage, frame);
                                    }else
                                    {
                                        _eCatalogueTable.updateECatalogue(productLineID,productLine, hp, rpm, voltage, frame);
                                    }
                                }       

                                HomeScreen.this.getActivity().runOnUiThread(new Runnable() {
                                    public void run() {
                                        Constant.showAlertDialog(Constant.DIALOG_TITLE_SUCCESS,Constant.MSG_SUCCESS, HomeScreen.this.getActivity(), false); 
                                        findGMTDateTime();
                                        _mEditPref=myPref.edit();
                                        _mEditPref.putString("PREVIOUS_DATETIME", dateTimeValue);
                                        _mEditPref.commit();
                                    }
                                });
                            }
                        }catch(Exception e)
                        {
                            e.printStackTrace();
                            HomeScreen.this.getActivity().runOnUiThread(new Runnable() {
                                public void run() {
                                    Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR,
                                            Constant.MSG_SERVER_FAIL, HomeScreen.this.getActivity(), false);        
                                }
                            });

                        }
                        progressDialog.cancel();
                    }

                }).start();
                break; 
            case Constant.PID_ALERTDIGLOG:
                Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR,Constant.MSG_SERVER_FAIL, HomeScreen.this.getActivity(),false);
                break;

            }
        };
    };

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,  Bundle savedInstanceState) {
        mContentView = inflater.inflate(R.layout.home_screen , container, false);

        _eCatalogueTable=new ECatalogueDatabase(HomeScreen.this.getActivity());
        _eCatalogueTable.open();

        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            _headetRelativelayout=(RelativeLayout)mContentView.findViewById(R.id.header_layout);
            _headetRelativelayout.setVisibility(View.GONE);

        }
        if(savedInstanceState!=null)
        {
            saveState="SavedInstance";
            rotateSaveInstace=true;
            Constant.checkPdf=false;
            //Toast.makeText(this.getActivity(),"savedInstaceState", Toast.LENGTH_LONG).show();
        }else
        {
            saveStateBoolea=true;
            saveState="NoSavedInstance";
            //  Toast.makeText(this.getActivity(),"No savedInstaceState", Toast.LENGTH_LONG).show();
        }


        _productText=(TextView)mContentView.findViewById(R.id.productline_txt);
        _hpText=(TextView)mContentView.findViewById(R.id.hp_txt);
        _rpmText=(TextView)mContentView.findViewById(R.id.rpm_txt);

        _voltageText=(TextView)mContentView.findViewById(R.id.voltage_txt);
        _frameSizeText=(TextView)mContentView.findViewById(R.id.frame_txt);

        _searchBypartEditText=(EditText)mContentView.findViewById(R.id.searchpart_edittxt);

        _searchButton=(Button)mContentView.findViewById(R.id.serach_btn);
        _searchButton.setEnabled(false);
        _searchButton.setOnClickListener(this);

        _syncButton=(Button)mContentView.findViewById(R.id.sync_btn);
        _syncButton.setOnClickListener(this);

        _productSpinner=(Spinner)mContentView.findViewById(R.id.productline_spinner);
        _productSpinner.setOnItemSelectedListener(this);

        _hpSpinner=(Spinner)mContentView.findViewById(R.id.hp_spinner);
        _hpSpinner.setOnItemSelectedListener(this);

        _rpmSpinner=(Spinner)mContentView.findViewById(R.id.rpm_spinner);
        _rpmSpinner.setOnItemSelectedListener(this);

        _voltageSpinner=(Spinner)mContentView.findViewById(R.id.voltage_spinner);
        _voltageSpinner.setOnItemSelectedListener(this);

        _frameSpinner=(Spinner)mContentView.findViewById(R.id.frame_spinner);
        _frameSpinner.setOnItemSelectedListener(this);

        _productRealtiveLayout=(RelativeLayout)mContentView.findViewById(R.id.product_layout);
        _productRealtiveLayout.setOnClickListener(this);

        _hpRelativeLayout=(RelativeLayout)mContentView.findViewById(R.id.hp_layout);
        _hpRelativeLayout.setOnClickListener(this);

        _rpmRelativeLayout=(RelativeLayout)mContentView.findViewById(R.id.rpm_layout);
        _rpmRelativeLayout.setOnClickListener(this);

        _voltageRelativeLayout=(RelativeLayout)mContentView.findViewById(R.id.voltage_layout);
        _voltageRelativeLayout.setOnClickListener(this);

        _framSizeRelativeLayout=(RelativeLayout)mContentView.findViewById(R.id.frame_layout);
        _framSizeRelativeLayout.setOnClickListener(this);

        useTextwatcher();

        _mHPArrayList.add(0, getString(R.string.hp_txt));
        _mRPMArrayList.add(0, getString(R.string.rpm_txt));
        _mVoltageArrayList.add(0,getString(R.string.voltage_txt));
        _mFrameSizeLineArrayList.add(0,getString(R.string.frame_txt));

        _productSpinner.setSelection(0);
        _hpSpinner.setSelection(0);

        _rpmSpinner.setSelection(0);
        _voltageSpinner.setSelection(0);
        _frameSpinner.setSelection(0);

        fetchProductLineFromDatabase();

        _productLineArrayAdapter = new ArrayAdapter(this.getActivity(),android.R.layout.simple_spinner_dropdown_item,_mProductLineArrayList);

        _hpArrayAdapter=new ArrayAdapter(this.getActivity(),android.R.layout.simple_spinner_dropdown_item,_mHPArrayList);
        _rpmArrayAdapter = new ArrayAdapter(this.getActivity(),android.R.layout.simple_spinner_dropdown_item,_mRPMArrayList);
        _voltageArrayAdapter = new ArrayAdapter(this.getActivity(),android.R.layout.simple_spinner_dropdown_item,_mVoltageArrayList);
        _frameSizeArrayAdapter=new ArrayAdapter(this.getActivity(),android.R.layout.simple_spinner_dropdown_item,_mFrameSizeLineArrayList);

        _productSpinner.setAdapter(_productLineArrayAdapter);
        _hpSpinner.setAdapter(_hpArrayAdapter);
        _rpmSpinner.setAdapter(_rpmArrayAdapter);
        _voltageSpinner.setAdapter(_voltageArrayAdapter);
        _frameSpinner.setAdapter(_frameSizeArrayAdapter);


        // GMT Date Time
        date=new Date();
        simpleDateFormat=new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
        myPref=getActivity().getPreferences(Context.MODE_PRIVATE);
        String PrivousDateTime=myPref.getString("PREVIOUS_DATETIME", "");
        boolean firstCheckAlert=myPref.getBoolean("FIRST_ALRT", firstTimeShowAllert);
        if(!firstCheckAlert)
        {
            showMessageAlert();
        }
        if(PrivousDateTime.equals("")||PrivousDateTime==null)
        {
            dateTimeValue= "01/01/2012 00:00:00";
        }else
        {
            dateTimeValue=PrivousDateTime;
        }
        return mContentView;
    }

    private void syncWithServer() {


        if (NetworkAvailablity.checkNetworkStatus(HomeScreen.this.getActivity()))
        {

            final ProgressDialog progressDialog = ProgressDialog.show(HomeScreen.this.getActivity(),"",Constant.MSG_SYNC);
            new Thread(new Runnable() {
                public void run() {
                    String response = "";
                    SoapObject request = new SoapObject(WebServiceDetails.SERVICENAMESPACE,WebServiceDetails.METHOD_CHECKLATESTDATADATE);
                    request.addProperty("lastmodifieddate",dateTimeValue);
                    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                    envelope.dotNet = true;
                    envelope.setOutputSoapObject(request);
                    AndroidHttpTransport httpTransport = new AndroidHttpTransport(WebServiceDetails.URL);
                    httpTransport.debug = true;
                    try {
                        httpTransport.call(WebServiceDetails.SOAP_CHECKLATESTDATADATE, envelope); // send

                        Object data = envelope.getResponse();
                        if (data instanceof SoapObject) {
                            SoapObject data2 = (SoapObject) data;
                            response = data2.toString();
                        } else if (data instanceof SoapPrimitive) {
                            SoapPrimitive data3 = (SoapPrimitive) data;
                            response = data3.toString();
                        } else if (data != null) {
                            response = data.toString();
                        } else if (data == null) {
                            response = "nodata";
                        }
                        serverResponse(response,Constant.PID_GETUPDATEDATA);
                    }catch (Exception e) {
                        e.printStackTrace();
                        serverResponse(null,Constant.PID_ALERTDIGLOG);
                    }
                    progressDialog.dismiss();
                }
            }).start();
        }
        else {
            Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR,Constant.MSG_INTERNETERROR, HomeScreen.this.getActivity(),false);
        }

    }


    public void onClick(View v) {
        fetchTextvalue();
        switch (v.getId()) {

        case R.id.serach_btn:
            if (NetworkAvailablity.checkNetworkStatus(HomeScreen.this.getActivity())){
                FragmentManager fm = this.getActivity().getSupportFragmentManager();
                int count=fm.getBackStackEntryCount();
                System.out.println("gdfgdgcvbccccccccccccccccccc "+count);
                for(int i = 0; i < count; ++i) {    
                    fm.popBackStack();
                }
                fetchTextvalue();


                if(!(_fetchProductText.equalsIgnoreCase(getString(R.string.product_txt))||_fetchHpText.equalsIgnoreCase( getString(R.string.hp_txt))
                        ||_fetchRPMText.equalsIgnoreCase( getString(R.string.rpm_txt))||_fetchVoltageText.equalsIgnoreCase(getString(R.string.voltage_txt))
                        ||_fetchFrameSizeText.equalsIgnoreCase(getString(R.string.frame_txt))))
                {
                    if(_mGetEditValue.equalsIgnoreCase(getString(R.string.enterpart_txt))||_mGetEditValue==null)
                    {
                        dataSheetCall();
                    }else
                    {
                        Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR, Constant.MSG_ENABLESEARCH, HomeScreen.this.getActivity(), false);
                        _searchBypartEditText.setText("");
                        _searchButton.setEnabled(true);
                        _mGetEditValue=(getString(R.string.enterpart_txt));
                    }
                }else if((!_mGetEditValue.equalsIgnoreCase(getString(R.string.enterpart_txt)))||_mGetEditValue!=null)
                {
                    if((_fetchProductText.equalsIgnoreCase(getString(R.string.product_txt))&&_fetchHpText.equalsIgnoreCase( getString(R.string.hp_txt))
                            &&_fetchRPMText.equalsIgnoreCase( getString(R.string.rpm_txt))&&_fetchVoltageText.equalsIgnoreCase(getString(R.string.voltage_txt))
                            &&_fetchFrameSizeText.equalsIgnoreCase(getString(R.string.frame_txt))))
                    {
                        dataSheetCall();
                    }
                    else
                    {
                        Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR, Constant.MSG_ENABLESEARCH, HomeScreen.this.getActivity(), false);
                        _searchBypartEditText.setText("");
                        _searchButton.setEnabled(true);
                        resetValue();

                    }
                }
            }else{
                Constant.showAlertDialog(Constant.DIALOG_TITLE_ERROR,Constant.MSG_INTERNETERROR, HomeScreen.this.getActivity(),false);
                _productSpinner.setSelection(0);
            }

            break;          



            case R.id.sync_btn:
        syncWithServer();

        break;
        default:
            break;
        }       
    }

    private void dataSheetCall()
    {
        if (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
            Intent datasheetIntent=new Intent(this.getActivity(),DataSheetScreenActivity.class);
            datasheetIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            datasheetIntent.putExtra("PRODUCTLINE", _productString);
            datasheetIntent.putExtra("HP", _hpString);
            datasheetIntent.putExtra("RPM",_rpmString);
            datasheetIntent.putExtra("VOLTAGE", _voltageString);
            datasheetIntent.putExtra("FRAMESIZE", _frameSizeString);
            datasheetIntent.putExtra("PART NUMBER", _mGetEditValue);
            Constant.putAllValue(_productString, _hpString, _rpmString, _voltageString, _frameSizeString,_mGetEditValue);
            startActivity(datasheetIntent);
        } else {

            if(saveStateBoolea)
            {
                ImageFragment rightFrag = (ImageFragment) getFragmentManager().findFragmentByTag("imageFragmentTag");
                FragmentTransaction ft = getFragmentManager().beginTransaction();
                ft.remove(rightFrag);
                ft.commit();
                saveStateBoolea=false;
            }else if(saveState.equalsIgnoreCase("SavedInstance")&&(rotateSaveInstace==true))
            {
                ImageFragment rightFrag = (ImageFragment) getFragmentManager().findFragmentByTag("imageFragmentTag");
                FragmentTransaction ft = getFragmentManager().beginTransaction();
                ft.remove(rightFrag);
                ft.commit();
                rotateSaveInstace=false;
            }

            DataSheetScreenFragment dataSheetFragment = new DataSheetScreenFragment();
            fragmentTransaction = this.getActivity().getSupportFragmentManager().beginTransaction();
            fragmentTransaction.add(R.id.top_right_datasheet_relative_layout, dataSheetFragment, "rightDrawingFragmentTag"); //First parameter is the container id
            fragmentTransaction.addToBackStack("1");
            fragmentTransaction.show(dataSheetFragment);
            fragmentTransaction.commit();

            Constant.putAllValue(_productString, _hpString, _rpmString, _voltageString, _frameSizeString,_mGetEditValue);

            _pdfIcon=(ImageButton)this.getActivity().findViewById(R.id.pdf_icon);
            _pdfIcon.setVisibility(View.VISIBLE);

            _pdfText=(TextView)this.getActivity().findViewById(R.id.pdf_txt);
            _pdfText.setVisibility(View.VISIBLE);
        }
        resetValue();
    }


    public void onNothingSelected(AdapterView<?> arg0) {
        Toast.makeText(this.getActivity(), "No select", Toast.LENGTH_LONG).show();
    }
    @Override
    public void onDestroy() {
        _eCatalogueTable.close();
        super.onDestroy();
    }
    @Override
    public void onResume() {
        super.onResume();
        if(!Constant.checkPdf)
        {
            _productSpinner.setSelection(0);
        }

    }

    public void serverResponse(String response, int processid) {
        Message msg = new Message();
        msg.arg2 = processid;
        msg.obj = response;
        _handler .sendMessage(msg);     
    }
    @Override
    public void onPause() {
        super.onPause();

    }

}
  • 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-15T23:28:37+00:00Added an answer on June 15, 2026 at 11:28 pm

    Might be The solution is to call dismiss() on the Dialog you created in ViewRootImpl.java before exiting the Activity.

    EDITED:

    see your Error is Saying Below :

    android.view.WindowLeaked: Activity com.weg.ecatalogfragment.ECatalogFragmentActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41457e20 that was originally added here
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:345)
    

    so Each View have a reference to their parent Context as you are passing constructor. If you leave an Activity without destroying Dialogs and other activity dynamically creat views, they still hold this reference to your Activity (if you created with this as Context: like new ANY(this)), so it will not be collected by the GC, causing a memory leak.

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

Sidebar

Related Questions

I have one web application which I have been working for some time.I am
I have developed an application which is working fine. In that i have used
all i am working on one application in which i have to used database.
I have a working web application which already has a login and registration system.
I have used threading in my web application which I have mentioned below: var
I am working in Silverlight 4.0 and have created a web application which is
I am currently working in iPhone application in which I have used wikitude api.
I am working with a legacy application in which we have used Strtus1.2. Now
I am working on ios5 and have used NSURLConnectionDataDelegate in my application which really
I have been working on an application which allows the user to make a

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.