在Android中我有一个listview,它们加载了十行。当我旋转设备时,列表视图为空,我丢失了所有插入的行。我该如何解决这个问题?
答案 0 :(得分:0)
在清单中的活动代码中添加此行..
android:configChanges="orientation|keyboardHidden|screenSize"
如果适合你,请将其标记为正确。
答案 1 :(得分:0)
public class MyUsersAdapter extends ArrayAdapter<Users>{
public MyUsersAdapter() {
super(SearchActivity.this,R.layout.row_friends,utenti);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if(row == null){
row = getLayoutInflater().inflate(R.layout.row_friends, parent,false);
}
Users current = utenti.get(position);
CircularImageView image = (CircularImageView)row.findViewById(R.id.users_image);
image.setImageBitmap(current.getImmagine());
Log.i("tag", "tag: "+image.getTag());
TextView name = (TextView)row.findViewById(R.id.users_name);
name.setText(current.getNome());
TextView online = (TextView)row.findViewById(R.id.users_state);
online.setText(""+current.getOnline());
return row;
}