문제

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 be loaded first. You forget to call setContentView().

That's why these controls

tvPoints = (TextView) findViewById(R.id.tvPoints);
tvRecord = (TextView) findViewById(R.id.tvRecord);

return null

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top