Android : Retrieving data from text field in pop up is throwing errors
<p>I am trying to get text field value from a pop up on clicking Save button. But it is throwing errors.</p>

<p>Code :-</p>

<pre><code>final Button btn_ContactDetails = (Button)findViewById(R.id.btn_ContactDetails);
btn_ContactDetails.setOnClickListener(new Button.OnClickListener(){

    public void onClick(View arg0) {
        LayoutInflater inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.contactdetails, null, true);

        final PopupWindow popUp = new PopupWindow(layout, LayoutParams.WRAP_CONTENT,  LayoutParams.WRAP_CONTENT, true);
        popUp.setBackgroundDrawable(new BitmapDrawable());
        popUp.setOutsideTouchable(true);
        popUp.setTouchInterceptor(new OnTouchListener() {

            public boolean onTouch(View v, MotionEvent event) {
                if(event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    popUp.dismiss();
                    return true;
                }
                return false;
            }
        });

        Button btnDismiss = (Button)layout.findViewById(R.id.dismiss);
            btnDismiss.setOnClickListener(new Button.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    popUp.dismiss();
                }
            });

        //On click Save - Contact Details
        Button btn_Save_ContactDetails = (Button)layout.findViewById(R.id.btn_Save_ContactDetails);
        btn_Save_ContactDetails.setOnClickListener(new Button.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub
                EditText mEdit, sEdit;
                mEdit = (EditText)findViewById(R.id.txt_HouseNameNumber);
                sEdit = (EditText)findViewById(R.id.txt_Address1);
                sEdit.setText(mEdit.getText().toString());//THIS LINE IS THROWING ERROR
                popUp.dismiss();
            }
        });
        popUp.showAtLocation(layout, Gravity.CENTER, 0, 0);
    }
});
</code></pre>

<p>Error :-</p>

<pre><code>06-12 03:21:37.828: E/AndroidRuntime(518): FATAL EXCEPTION: main
06-12 03:21:37.828: E/AndroidRuntime(518): java.lang.NullPointerException
06-12 03:21:37.828: E/AndroidRuntime(518):  at sai.om.SaiActivity$3$3.onClick(SaiActivity.java:171)
06-12 03:21:37.828: E/AndroidRuntime(518):  at android.view.View.performClick(View.java:2408)
06-12 03:21:37.828: E/AndroidRuntime(518):  at android.view.View$PerformClick.run(View.java:8816)
06-12 03:21:37.828: E/AndroidRuntime(518):  at android.os.Handler.handleCallback(Handler.java:587)
06-12 03:21:37.828: E/AndroidRuntime(518):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-12 03:21:37.828: E/AndroidRuntime(518):  at android.os.Looper.loop(Looper.java:123)
06-12 03:21:37.828: E/AndroidRuntime(518):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-12 03:21:37.828: E/AndroidRuntime(518):  at java.lang.reflect.Method.invokeNative(Native Method)
06-12 03:21:37.828: E/AndroidRuntime(518):  at java.lang.reflect.Method.invoke(Method.java:521)
06-12 03:21:37.828: E/AndroidRuntime(518):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-12 03:21:37.828: E/AndroidRuntime(518):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-12 03:21:37.828: E/AndroidRuntime(518):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>Can anyone help me find what I am doing wrong here?
I have provided comments to the line throwing error.</p>
