Tenho um textView
e gostaria que, em vez do preenchimento com um arraylist
, com todos os itens em seu setText
, que ele fosse criado várias vezes na tela, com os respectivos itens deste array, em cada setText
de cada textView
. Segue o código:
public class RideRequestActivity extends AppCompatActivity implements CommunityRequestView {Segue o código:
public class RideRequestActivity extends AppCompatActivity implements CommunityRequestView {
private SessionManager user;
private String departure;
private String arrival;
@BindView(R.id.request_email)
TextView email;
@BindView(R.id.request_name)
TextView name;
@BindView(R.id.request_photo)
ImageView photo;
@BindView(R.id.textView_first)
TextView first;
@BindView(R.id.textView_second)
TextView second;
@BindView(R.id.textView_third)
TextView third;
@BindView(R.id.button0)
CheckBox button0;
@BindView(R.id.button1)
CheckBox button1;
@BindView(R.id.button2)
CheckBox button2;
@BindView(R.id.button3)
CheckBox button3;
@BindView(R.id.button4)
CheckBox button4;
@BindView(R.id.button5)
CheckBox button5;
@BindView(R.id.send_offer_request)
Button send_offer_request;
@BindView(R.id.send_ask_request)
Button send_ask_request;
@BindView(R.id.txtInterests)
TextView mListView;
@BindView(R.id.img_favorite)
ImageView imgFavorite;
CommunityPresenter presenter;
UserCommunity selectedUser;
UsersMySQLiteHelper serviceDB;
private List<UserCommunity> userInterest = new ArrayList<UserCommunity>();
@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);
serviceDB = new UsersMySQLiteHelper(AppController.getInstance().getApplicationContext());
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));
imgFavorite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(selectedUser.favorite == 0) {
selectedUser.favorite = 1;
imgFavorite.setImageResource(R.drawable.ic_star_black_on_48px);
}else{
selectedUser.favorite = 0;
imgFavorite.setImageResource(R.drawable.ic_star_border_black_off_48px);
}
selectedUser.save(serviceDB, user.getLoggedUser().getCompany());
}
});
populateInterests();
getPoints();
imgFavorite = (ImageView)findViewById(R.id.img_favorite);
if (selectedUser.favorite == 0){
imgFavorite.setImageResource(R.drawable.ic_star_border_black_off_48px);
}else{
imgFavorite.setImageResource(R.drawable.ic_star_black_on_48px);
}
}
private void getPoints() {
}
private void populateInterests() {
RequestManager.UsersInterests(selectedUser.id, new FutureCallback<String>() {
@Override
public void onCompleted(Exception e, String result) {
if(e== null || result != null) {
UserCommunity user = new Gson().fromJson(new JsonParser().parse(result).getAsJsonObject().get("data").toString(),
UserCommunity.class);
selectedUser.interests = user.interests;
String name = "";
TextView txt_Interests = (TextView) findViewById(R.id.txtInterests);
for (UserCommunity.Interest interest: selectedUser.interests
) {
name += interest.name + " ";
txt_Interests.setText(name);
}
String point = "";
TextView points = (TextView)findViewById(R.id.txt_Points);
selectedUser.points = user.points;
point = selectedUser.points + "\npontos";
points.setText(point);
}
}
});
}