В MainActivity объявляю переменную типа массив:
....
private String[] textitems;
public String[] getTextitems(){
return textitems;
}
.....
Заполняю этот массив в цикле:
for (int i=0; i < items.length(); i++){
JSONObject item = (JSONObject) items.get(i);
String item_text = (String) item.get("text");
textitems[i] = item_text;
}
Объявляю его в другом классе:
private String[] textitems;
public void setTextitems(String[] textitems){
this.textitems = textitems;
}
Вызываю:
...
TextView tvPage = (TextView) view.findViewById(R.id.tvPage);
tvPage.append(textitems[pageNumber]);
...
Насколько я все верно делаю?