SeekBar in an alertDialog
<p>I am trying to place a <code>SeekBar</code> in an <code>AlertDialog</code>. I have this code:</p>

<pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(GameScreen.this);
        LayoutInflater inflater = GameScreen.this.getLayoutInflater();
        builder.setView(inflater.inflate(R.layout.betvalue, null))
               .setPositiveButton  ... 
               .setNegativeButton ...
               .setTitle("Enter bet amount");
        SeekBar sbBetVal = (SeekBar)findViewById(R.id.sbBetVal);
        tvBetVal = (TextView) findViewById(R.id.tvBetVal);
        sbBetVal.setMax(playerList[0].getChipCount());
        sbBetVal.setProgress(0);
        sbBetVal.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                // TODO Auto-generated method stub
                tvBetVal.setText(String.valueOf(progress));
            }
        });

        builder.create();
        builder.show();
</code></pre>

<p>However, this gives me a <code>NullPointerException</code>. Why is this and how can I fix this? </p>

<p>Here's the logcat:</p>

<pre><code>01-11 18:16:52.898: E/AndroidRuntime(27668): FATAL EXCEPTION: main
01-11 18:16:52.898: E/AndroidRuntime(27668): java.lang.NullPointerException
01-11 18:16:52.898: E/AndroidRuntime(27668):    at com.rhiokai.chipcounter.GameScreen.onClick(GameScreen.java:214)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at android.view.View.performClick(View.java:4202)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at android.view.View$PerformClick.run(View.java:17340)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at android.os.Handler.handleCallback(Handler.java:725)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at android.os.Handler.dispatchMessage(Handler.java:92)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at android.os.Looper.loop(Looper.java:137)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at android.app.ActivityThread.main(ActivityThread.java:5039)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at java.lang.reflect.Method.invokeNative(Native Method)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at java.lang.reflect.Method.invoke(Method.java:511)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-11 18:16:52.898: E/AndroidRuntime(27668):    at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>And here's the xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/betvalue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp" &gt;

&lt;TextView
    android:id="@+id/tvBetVal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:text="@string/chips_fill"
    android:textAppearance="?android:attr/textAppearanceLarge" /&gt;

&lt;SeekBar
    android:id="@+id/sbBetVal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tvBetVal"
    android:layout_centerHorizontal="true" /&gt;

&lt;/RelativeLayout&gt;
</code></pre>
