I get an array with interest items and should set them to setText
of a given TextView
.
I want all items in this array to appear on the screen, horizontally. In my layout xml, I just put 1 textView to get all the items that come in this array.
My question, do I have to mount a ListView, horizontally, to receive this array and display it on the screen? Or, can I just grab the items and put them in the setText property of this TextView?
Follow the code:
@BindView(R.id.txtInterests)
TextView txt_interests;
CommunityPresenter presenter;
UserCommunity selectedUser;
List<String> interest = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setEnterTransition(new Fade());
}
setContentView(R.layout.activity_ride_request);
ButterKnife.bind(this);
presenter = new CommunityPresenter(this);
first.setText(presenter.getDay(0));
second.setText(presenter.getDay(1));
third.setText(presenter.getDay(2));
user = new SessionManager();
selectedUser = CommunityService.i(getContext()).selectedUser;
reloadView();
send_offer_request.setOnClickListener(presenter.sendRequestOnClickListener(0));
send_ask_request.setOnClickListener(presenter.sendRequestOnClickListener(1));
populateInterests();
}
private void populateInterests() {
RequestManager.UsersInterests(selectedUser.id, new FutureCallback<String>() {
@Override
public void onCompleted(Exception e, String result) {
//array com os interesses
interest = new Gson().fromJson(new JsonParser().parse(result).getAsJsonObject().get("data").toString(), new TypeToken<ArrayList<String>>() {
}.getType());
txt_interests.setText(); //preencher o TextView com os interesses
}
});
}