问题的“列表”内的元件的数量更大的计数器大于内“排行榜”的计数器大于
元件这是由一个服务器的响应填充的数量。
公共类ListQuestions延伸活动{
private ListQuestionsAdapter adapter;
ListView listquestion;
List<ResponseQuestionDto> questions = new ArrayList<>();
List<ResponseQuestionDto> questionsSelected;
int positionQuestion;
final Handler mHandler = new Handler();
ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
try{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listquestions);
dialog = ProgressDialog.show(this, "",
getString(R.string.progress), true);
Thread thread = new Thread() {
@Override
public void run() {
try {
questions = BusinessLogic.getQuestions(LiveCookie.getInstance().getToken());
mHandler.post(mUpdate);
} catch (Exception e) {
Util.alert(ListQuestions.this, getString(R.string.Error));
}
}
};
thread.start();
}catch (Exception e)
{
Toast.makeText(ListQuestions.this, getString(R.string.Error), Toast.LENGTH_LONG).show();
}
}
final Runnable mUpdate = new Runnable() {
@Override
public void run() {
try {
dialog.dismiss();
questionsSelected = LiveCookie.getInstance().getQuestionsSelected();
positionQuestion = LiveCookie.getInstance().getPositionQuestion();
try {
if(questionsSelected != null)
{
for (int i=0;i<questionsSelected.size();i++) {
if (questionsSelected != null) {
if (questionsSelected.get(i).pregunta != null) {
if (positionQuestion != i) {
for (int e = 0; e < questions.size(); e++) {
if (questions.get(e) != null) {
if (questions.get(e).pregunta.equals(questionsSelected.get(i).pregunta)) {
questions.remove(questions.get(e));
}
}
}
}
}
}
}
}
}catch (Exception e)
{
//Not Used
}
listquestion = (ListView) findViewById(R.id.listquestion);
adapter = new ListQuestionsAdapter(ListQuestions.this,questions);
listquestion.setAdapter(adapter);
listquestion.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> adapter2, View v, int position, long id) {
questionsSelected = LiveCookie.getInstance().getQuestionsSelected();
ResponseQuestionDto selected = questions.get(position);
positionQuestion = LiveCookie.getInstance().getPositionQuestion();
questionsSelected.set(positionQuestion,selected);
LiveCookie.getInstance().setQuestionsSelected(questionsSelected);
ListQuestions.this.finish();
}});
}catch (Exception e)
{
dialog.dismiss();
Toast.makeText(ListQuestions.this, getString(R.string.Error), Toast.LENGTH_LONG).show();
ListQuestions.this.finish();
}
}
};
}
起初名单是14,但是当我在 “setOnItemClickListener” 检查,这是18
你如何填写此表前检查? –
请再次检查该问题@KillerDeath –