开发者

facing problem while displaying the value of the variable

开发者 https://www.devze.com 2023-03-31 08:31 出处:网络
I have just tried to display the val开发者_如何学JAVAue of the variable but is showing some kind of exception

I have just tried to display the val开发者_如何学JAVAue of the variable but is showing some kind of exception that is FORCE CLOSE.

the code i have tried is

TextView myTextView = (TextView) findViewById(R.id.result9);
myTextView.setText("your score is " +count);

considered count=0 intially.

Can any one suggest me for this problem

thanks in advance


if myTexyView is in dialog you have to do this: myTextView = (TextView) dialog.findViewById();

anyway do clean project...this happens sometimes:

in eclipse: project->clean->your project


Seems findViewById() returns null. It means that either there's no widget with id result9 in current layout or your forgot to setContentView().


can please check your xml which one you have set, setContainView() it mast have TextView with "result9" this id.

0

精彩评论

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