Your code probably looks like this
AlertDialog a = builder.create();
a.setButton(AlertDialog.BUTTON_POSITIVE, "Ok", new OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
TextView b = new TextView(this);
...
}
You need to create the TextView outside the scope of the OnClickListener.
The "this" has to point to Context, which is your Activity.
BR,
Adrian Vintu
http://adrianvintu.com
On Sat, Mar 27, 2010 at 3:28 PM, rubeN_vl <[email protected]> wrote:
> Hi,
>
> i'm trying to create a new TextView when a button is clicked.
> TextView b = new TextView(this); isnt working cause 'this' refers to
> new View.onClickListener.
> Been searchin for hours, cant find a solution.
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe from this group, send email to android-developers+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>
--
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
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.