开发者

Android Text View [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. 开发者_如何学Python Closed 11 years ago.

I am creating a pop up window in click event,inside that pop up window there are text view and Button... If i create a Id in XML and set the text by TextView txt=(TextView)findViewById(R.id.text)

txt.setText("Message");

I ma getting Null pointer Exception same for Button..

Pls


findViewById is relative to the parent. if you call it from another window (popup) and not from activity, it won't find the R.id.text and return null.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜