What does your layout file look like? Also, the width will be zero in onCreate because nothing has been displayed yet... I don't know for sure if it will work, but you could try putting that code in onResume()...
Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Mar 17, 2011 at 5:58 AM, Syed Rakib Al Hasan < [email protected]> wrote: > here is the pseudocode of what i tried to in myActivity: > > onCreate{ > * > > //-------------------------------------------------------------------------------------------- > * > super.onCreate(); > setContentView( myXMLlayout ); > * > > //-------------------------------------------------------------------------------------------- > * > View v = findViewByID( getIdFromIntentExtras() ) ; > v.setWidth( v.getWidth() * 2 ); > * /* * > * * the problem is here: * > * * the call to v.getWidth() is always returning 0 * > * * when called from the onCreate() state* > * */* > } > > private int getIdFromIntentExtras(){ > return the id which was put as extra into the intent that was used to > fire up this activity > * /* * > * * there are 20 buttons defined in this activity's layout xml file* > * * i want to have ONE out of these 20 button be resized to double > when this activity starts up.* > * * and i will refer to THAT buttonID via intent extras which is used > to fire up this activity* > * */* > } > > -- > 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

