开发者

null pointer exception in button declaration

in this line am getting NullPointerException can any one help me to fix this

Button up[]; 
up[0] = (Button) findViewById(R.id.adultup1);
up[0].setOnClickListener(new View.OnClickListener() {
    public void onClick(View v开发者_Go百科iew) {}


You need to allocate the Button array, e.g.

up = new Button[10];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜