Is pb nil? If so, you might want to make sure a control with that ID exists
on that layout...
On Oct 27, 2011 11:05 PM, "Anuj Goyal" <[email protected]> wrote:
> I am attempting to use a ProgressBar in a Dialog but when I try to use
> setMax() my app crashes with an unhandled Exception. When debugging the
> Exception has no information in it.
> WinXP, Android 2.2, API level 8
>
>
> mQuestionDialog = new Dialog(this);
> mQuestionDialog.setContentView(R.layout.wronganswer);
> mQuestionDialog.setCancelable(false);
>
> //works
> tv = (TextView)mQuestionDialog.findViewById(R.id.wrong_percent);
> tv.setText("25%");
> ProgressBar pb = (ProgressBar) findViewById(R.id.progressbar_wrong);
> setProgressBarVisibility(true);
>
> //doesn't work
> TextView tv = (TextView)mQuestionDialog.findViewById(R.id.wrong_percent);
> tv.setText("25%");
> ProgressBar pb = (ProgressBar) findViewById(R.id.progressbar_wrong);
> pb.setMax(100); // causes Exception
> pb.setProgress(25);
> setProgressBarVisibility(true);
>
> --
> 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
--
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