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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:17:50+00:00 2026-06-12T06:17:50+00:00

I have written an to view , edit and create contacts . When I

  • 0

I have written an to view , edit and create contacts . When I run the code in emulator , it allows me to type the name but I cannot switch to other Edit Text and the emulator freezes.Even if I switch, the only thing I can do is press back button after. here is my code , could you please help me in debugging. I am new to android programming , all suggestions are welcome.

public class AddNewContact extends Activity implements OnClickListener {
    Button Save;
    EditText Newname, NewPersonalPhone, NewHomePhone, NewOfficePhone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.newcontact);
        initialize();
    }

    private void initialize() {
        // TODO Auto-generated method stub
        Save = (Button) findViewById(R.id.bSaveContact);
        Save.setOnClickListener(this);
        Newname = (EditText) findViewById(R.id.newname);
        Newname.setOnClickListener(this);
        NewPersonalPhone = (EditText) findViewById(R.id.newpersonalphone);
        NewPersonalPhone.setOnClickListener(this);
        NewHomePhone = (EditText) findViewById(R.id.newhomephone);
        NewHomePhone.setOnClickListener(this);
        NewOfficePhone = (EditText) findViewById(R.id.newofficephone);
        NewOfficePhone.setOnClickListener(this);

    }

    public void onClick(View v) {
        boolean didItWork = true;
        // TODO Auto-generated method stub
        try {
            String nname = Newname.getText().toString();
            String npphone = NewPersonalPhone.getText().toString();
            String nhphone = NewHomePhone.getText().toString();
            String nophone = NewOfficePhone.getText().toString();


            DBContact newentry = new DBContact(AddNewContact.this);
            newentry.open();
            newentry.newRow(nname, npphone, nhphone, nophone);
            newentry.close();

        } catch (Exception e) {
            didItWork = false;
            String error = e.toString();
            Dialog display = new Dialog(this);
            display.setTitle("ERROR");
            TextView text = new TextView(this);
            text.setText(error);
            display.setContentView(text);
            display.show();
        } finally {
            if (didItWork) {
                Dialog display = new Dialog(this);
                display.setTitle("CONTACT SAVED!");
                TextView text = new TextView(this);
                text.setText("Sucess");
                display.setContentView(text);
                display.show();
            //  startActivity(new Intent("CONTACTS.class"));
            }
        }
    }

}

LOGCAT

09-26 02:58:35.518: E/WindowManager(1913): Activity com.example.contactlist.AddNewContact has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41236e28 that was originally added here
09-26 02:58:35.518: E/WindowManager(1913): android.view.WindowLeaked: Activity com.example.contactlist.AddNewContact has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41236e28 that was originally added here
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:374)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:292)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.Window$LocalWindowManager.addView(Window.java:547)
09-26 02:58:35.518: E/WindowManager(1913):  at android.app.Dialog.show(Dialog.java:277)
09-26 02:58:35.518: E/WindowManager(1913):  at com.example.contactlist.AddNewContact.onClick(AddNewContact.java:56)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.View.performClick(View.java:4084)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.View.onKeyUp(View.java:7669)
09-26 02:58:35.518: E/WindowManager(1913):  at android.widget.TextView.onKeyUp(TextView.java:5382)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.KeyEvent.dispatch(KeyEvent.java:2633)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.View.dispatchKeyEvent(View.java:7086)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1358)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1358)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1358)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1358)
09-26 02:58:35.518: E/WindowManager(1913):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1892)
09-26 02:58:35.518: E/WindowManager(1913):  at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1369)
09-26 02:58:35.518: E/WindowManager(1913):  at android.app.Activity.dispatchKeyEvent(Activity.java:2356)
09-26 02:58:35.518: E/WindowManager(1913):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1819)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3575)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl.deliverKeyEvent(ViewRootImpl.java:3531)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3113)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132)
09-26 02:58:35.518: E/WindowManager(1913):  at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2930)
09-26 02:58:35.518: E/WindowManager(1913):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 02:58:35.518: E/WindowManager(1913):  at android.os.Looper.loop(Looper.java:137)
09-26 02:58:35.518: E/WindowManager(1913):  at android.app.ActivityThread.main(ActivityThread.java:4745)
09-26 02:58:35.518: E/WindowManager(1913):  at java.lang.reflect.Method.invokeNative(Native Method)
09-26 02:58:35.518: E/WindowManager(1913):  at java.lang.reflect.Method.invoke(Method.java:511)
09-26 02:58:35.518: E/WindowManager(1913):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-26 02:58:35.518: E/WindowManager(1913):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-26 02:58:35.518: E/WindowManager(1913):  at dalvik.system.NativeStart.main(Native Method)
  • 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-12T06:17:51+00:00Added an answer on June 12, 2026 at 6:17 am

    Do you need
    setOnClickListener()

    for even edittexts?

    why are you trying to use setOnClickListener() on edittexts. Is there any special reason for this?

    once try to remove them and just use setOnClickListener() for button and run the logic.
    If you have any special reason for using setOnClickListener() for edittext explain it once

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

Sidebar

Related Questions

I have written a subclass of UIViewController which creates a view programmatically, instead of
I have the view function in django that written like a dispatcher calling other
I have written this code inside a servlet to delete certain records from three
I have written this code in JavaScript and works perfectly fine when I include
I understand what the CalledFromWrongThreadException exception means, but I cannot comprehend how the code
I have written an application in Code Igniter. Unless i declare the <!DOCTYPE HTML>
hi i am new developer on android i have written code for display simple
I have written a small jquery application that allows a person to slide a
I have the following fields for my sql view: name | description | date
have written this little class, which generates a UUID every time an object of

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.