android - Why does this class, when the method onResume is called, give error NullPointerException? -


public class scores extends activity {  textview tvpoints; textview tvrecord;  int record = 0; int points = 0;  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);      tvpoints = (textview) findviewbyid(r.id.tvpoints);     tvrecord = (textview) findviewbyid(r.id.tvrecord);      points = getintent().getintextra("points", 0);     record = getintent().getintextra("record", 0); }  @override protected void onresume() {     // todo auto-generated method stub     super.onresume();      tvpoints.settext("points: "+points);     tvrecord.settext("record: "+record); } 

}

the layout should loaded first. forget call setcontentview().

that's why these controls

tvpoints = (textview) findviewbyid(r.id.tvpoints); tvrecord = (textview) findviewbyid(r.id.tvrecord); 

return null


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -