I'm building a dialog including seekbar but i can't locate the seekbar
by findViewById, it only returns nullpoint.

My code:
Context mContext = this;
                LayoutInflater inflater = (LayoutInflater)
mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
                View layout = inflater.inflate(R.layout.brightness,
                                               (ViewGroup)
findViewById(R.id.layout_root));

                builder = new AlertDialog.Builder(mContext);
                builder.setView(layout);
                builder.setTitle("Brightness");
                builder.setPositiveButton("Ok", new
DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int 
whichButton) {
/////////// The seekBar here is a null point however?
                                SeekBar seekBar = (SeekBar) 
findViewById(R.id.seekbar);
                                int progress = seekBar.getProgress();
                                Log.v(TAG, "=====++++ progress is : " + 
progress);
                        }
                });

And my layouy brightness.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:id="@+id/layout_root" android:orientation="vertical"
        android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
        <ImageView android:id="@+id/brightness_level_icon"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:src="@drawable/
brightness_level_icon"
               />
        <SeekBar android:id="@+id/seekbar" android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:max="255"
                android:progress="125" />
</LinearLayout>

Any hints from your experts?thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to