开发者

Android Text View [closed]

开发者 https://www.devze.com 2023-01-31 23:52 出处:网络
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 applic
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

精彩评论

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