Actually, the first part is not true -- you just have to use the right 'this'. Just use MyOuterClassName.this and all will be fine. You could also copy it to a final variable but there's no need since Java provides this mechanism for just this situation.
On Mar 27, 7:44 am, Adrian Vintu <adrianvi...@gmail. > 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%2Bunsubs > > [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.

