Having Issues with Custom Dialog Box
<p>I need some help with my custom dialog box. This is the first time I have built a custom dialog box and for some reason it keeps crashing. The below code is what I have in my <code>onCreate()</code> method. I want to click on the edittext box bring up the dialog box then enter the ticker symbol or stock price, hit OK and it will populate the edittext box. Please help</p>

<pre><code>public void test() {
    // Click on Stock Price to bring up dialog box
    myStockPrice.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            // Create the dialog
            final Dialog dialog = new Dialog(
                    OptionsPricingCalculatorActivity.this);

            // Set the content view to our xml layout
            dialog.setContentView(R.layout.enterstocksym);

            // Set the title of the dialog. this space is always drawn even
            // if blank so might as well use it
            dialog.setTitle("Ticker Symbol");

            dialog.setCancelable(true);
            // dialog.setMessage("Enter Company Ticker Symbol");

            // Here we add functionality to our dialog box's content. In
            // this example it's the two buttons

            // Set an EditText view to get user input
            input = (EditText) findViewById(R.id.StockSymbol);
            input2 = (EditText) findViewById(R.id.StockPrice);

            Button okButton = (Button) dialog.findViewById(R.id.BtnOk);

            okButton.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    Tickervalue = input.getEditableText().toString().trim();
                    // Do something with value!

                    // Toast.makeText(getApplicationContext(), value,
                    // Toast.LENGTH_SHORT).show();
                    // Send Stock Symbol into Request
                    SoapObject request = new SoapObject(NAMESPACE,
                            METHOD_NAME);
                    request.addProperty("symbol", Tickervalue);
                    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                            SoapEnvelope.VER11);
                    envelope.setOutputSoapObject(request);
                    envelope.dotNet = true;
                    HttpTransportSE httpTransport = new HttpTransportSE(
                            SERVICE_URL);
                    // httpTransport.debug = true;
                    try {
                        httpTransport.call(SOAP_ACTION, envelope);
                        SoapPrimitive result = (SoapPrimitive) envelope
                                .getResponse();
                        parseResponse(result.toString());
                    } catch (Exception e) {
                        Log.d("STOCK",
                                e.getClass().getName() + ": "
                                        + e.getMessage());
                        Toast t = Toast.makeText(
                                OptionsPricingCalculatorActivity.this,
                                e.getClass().getName() + ": "
                                        + e.getMessage(), 10);
                        t.show();
                    }

                }

                private void parseResponse(String response)
                        throws Exception {
                    // TODO Auto-generated method stub

                    DocumentBuilderFactory dbf = DocumentBuilderFactory
                            .newInstance();
                    DocumentBuilder db = dbf.newDocumentBuilder();
                    Document document = db.parse(new InputSource(
                            new InputStreamReader(new ByteArrayInputStream(
                                    response.getBytes()), "UTF-8")));
                    Element element = document.getDocumentElement();
                    NodeList stocks = element.getElementsByTagName("Stock");
                    if (stocks.getLength() &gt; 0) {
                        for (int i = 0; i &lt; stocks.getLength();) {
                            Element stock = (Element) stocks.item(i);
                            Element Tickervalue = (Element) stock
                                    .getElementsByTagName("Last").item(0);
                            // Send data from response to OUTPUT object
                            EditText tv = (EditText) findViewById(R.id.txtStockPrice);
                            tv.setText(Tickervalue.getFirstChild()
                                    .getNodeValue());
                            break;
                        }
                    }
                }
            });

            Button cancelButton = (Button) dialog
                    .findViewById(R.id.BtnCancel);
            cancelButton.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });
            dialog.show();

        }
    });
</code></pre>

<p>Logcat</p>

<pre><code>09-24 04:10:51.252: ERROR/AndroidRuntime(428): FATAL EXCEPTION: main
09-24 04:10:51.252: ERROR/AndroidRuntime(428): java.lang.NullPointerException
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at com.CSV.Buescher.OptionsPricingCalculatorActivity$2$1.onClick(OptionsPricingCalculatorActivity.java:186)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at android.view.View.performClick(View.java:2408)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at android.view.View$PerformClick.run(View.java:8816)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at android.os.Handler.handleCallback(Handler.java:587)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at android.os.Looper.loop(Looper.java:123)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at java.lang.reflect.Method.invokeNative(Native Method)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at java.lang.reflect.Method.invoke(Method.java:521)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-24 04:10:51.252: ERROR/AndroidRuntime(428):     at dalvik.system.NativeStart.main(Native Method)
09-24 04:10:51.282: WARN/ActivityManager(59):   Force finishing activity com.CSV.Buescher/.OptionsPricingCalculatorActivity
09-24 04:10:51.865: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{44ece368 com.CSV.Buescher/.OptionsPricingCalculatorActivity}
</code></pre>
