android - Can't access a compoent after casting set.id() manually -
i have 1 little problem, can guys me.
i have code this:
textview tz; textview tv = new textview(this); tv.setid(0x7f090024); tv.settext("hello"); view vv = findviewbyid(0x7f090024); if (vv != null) { log.e("number_id", "not null"); } else log.e("number_id", "null"); // return error (java lang null pointer exception) tz = (textview) findviewbyid(0x7f090024); log.e("test", tz.gettext().tostring()); why result return null , can't value second textfield tz?
it returns null because findviewbyid refers view hierarchy built setcontentview. textview not belong it, can not retrieve findviewbyid.
Comments
Post a Comment