simple solution to your problem:
textObjectPartA.setText(String.valueOf(partA));
textObjectPartB.setText(String.valueOf(partB));
buttonObjectChoice1.setText(String.valueOf(correctAnswer));
buttonObjectChoice2.setText(String.valueOf(wrongAnswer1));
buttonObjectChoice3.setText(String.valueOf(wrongAnswer2));
Android Studio offers you the following: if you want to add something to a text view, you need to use placeholders.
An example of using placeholders is as follows:
file: strings.xml
...
<string name="part_a">part a value = %1$s.</string>
...
file: activity_main.xml
...
<TextView
android:id="@+id/R.id.textPartA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/part_a" />
...
file name: GameActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//here we initialize all our varibles
int partA = 9;
int partB = 2;
correctAnswer = partA * partB;
int wrongAnswer1 = correctAnswer - 1;
int wrongAnswer2 = correctAnswer + 1;
TextView textObjectPartA = (TextView)findViewById(R.id.textPartA);
TextView textObjectPartB = (TextView)findViewById(R.id.textPartB);
buttonObjectChoice1 = (Button)findViewById(R.id.buttonChoice1);
buttonObjectChoice2 = (Button)findViewById(R.id.buttonChoice2);
buttonObjectChoice3 = (Button)findViewById(R.id.buttonChoice3);
Resources res = getResources();
String partA_text = String.format(res.getString(R.string.part_a), partA);
textObjectPartA.setText(partA_text );
...
, . : Android-