How can i fill one cell of array in java (android Studio)

Viewed 123

I write this but all cells fill together.

how can I fix it.

 Integer [] history=new Integer[5];

 for (int i=0;i<history.length;i++) {
     history[i]=Jamkon.intValue();
 }

 txt_H.setText(Arrays.toString(history));
1 Answers

You are using a loop which will go through all indices of the array. If you want to only write one value, you will have to decide on what index first.

    int index =??? 
    history[index] = Jamkon.intValue()
Related