[Solved] Somethings wrong with my code TEXTVIEW


Make sure your verScore has the reference of TextView in XML.

Try this:

int verbalSc = 0;
TextView verScore;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ...........
    .................
    verScore = (TextView) findViewById(R.id.your_textview);
}

public void verbal1(){
    verbalSc = verbalSc + 1;
    Toast.makeText(getBaseContext(), "1", Toast.LENGTH_SHORT).show();

    verScore.setText(Integer.toString(verbalSc));
}

1

solved Somethings wrong with my code TEXTVIEW