моя проблема в том, что я никогда раньше не видел ...шоу TextView неправильный текст
Я пытаюсь сделать приложение для Android, и я застрял на одной маленькой ошибки, и это один очень сложно.
У меня есть 20 TextViews, 10 средних размеров и 10 обычных размеров, маленькие.
И как-то два из этих текстовых изображений, один носитель, а другой - маленький, меняют текст один на другой. Первый должен показывать текст, а второй - номер. Как-то они обратные, и я продолжаю смотреть на код, и я не могу понять, почему.
Некоторые из вас думают, что это простая задача решить, что я просто неправильно использую коды, но я скажу, что я проверял снова и снова, и это кажется правильным.
public void showWritings(){
TextView tv1stSpentReportM = (TextView) findViewById(R.id.tv1stSpentReportM);
tv1stSpentReportM.setText(vetorGastos[9].getTipoGasto());
TextView tv2stSpentReportM = (TextView) findViewById(R.id.tv2stSpentReportM);
tv2stSpentReportM.setText(vetorGastos[8].getTipoGasto());
TextView tv3stSpentReportM = (TextView) findViewById(R.id.tv3stSpentReportM);
tv3stSpentReportM.setText(vetorGastos[7].getTipoGasto());
TextView tv4stSpentReportM = (TextView) findViewById(R.id.tv4stSpentReportM);
tv4stSpentReportM.setText(vetorGastos[6].getTipoGasto());
TextView tv5stSpentReportM = (TextView) findViewById(R.id.tv5stSpentReportM);
tv5stSpentReportM.setText(vetorGastos[5].getTipoGasto());
TextView tv6stSpentReportM = (TextView) findViewById(R.id.tv6stSpentReportM);
tv6stSpentReportM.setText(vetorGastos[4].getTipoGasto());
TextView tv7stSpentReportM = (TextView) findViewById(R.id.tv7stSpentReportM);
tv7stSpentReportM.setText(vetorGastos[3].getTipoGasto());
TextView tv8stSpentReportM = (TextView) findViewById(R.id.tv8stSpentReportM);
tv8stSpentReportM.setText(vetorGastos[2].getTipoGasto());
TextView tv9stSpentReportM = (TextView) findViewById(R.id.tv9stSpentReportM);
tv9stSpentReportM.setText(vetorGastos[1].getTipoGasto());
TextView tv10stSpentReportM = (TextView) findViewById(R.id.tv10stSpentReportM);
tv10stSpentReportM.setText(vetorGastos[0].getTipoGasto());
TextView tv1stSpentReportV = (TextView) findViewById(R.id.tv1stSpentReportV);
tv1stSpentReportV.setText(String.valueOf(vetorGastos[9].getValorGasto()));
TextView tv2stSpentReportV = (TextView) findViewById(R.id.tv2stSpentReportV);
tv2stSpentReportV.setText(String.valueOf(vetorGastos[8].getValorGasto()));
TextView tv3stSpentReportV = (TextView) findViewById(R.id.tv3stSpentReportV);
tv3stSpentReportV.setText(String.valueOf(vetorGastos[7].getValorGasto()));
TextView tv4stSpentReportV = (TextView) findViewById(R.id.tv4stSpentReportV);
tv4stSpentReportV.setText(String.valueOf(vetorGastos[6].getValorGasto()));
TextView tv5stSpentReportV = (TextView) findViewById(R.id.tv5stSpentReportV);
tv5stSpentReportV.setText(String.valueOf(vetorGastos[5].getValorGasto()));
TextView tv6stSpentReportV = (TextView) findViewById(R.id.tv6stSpentReportV);
tv6stSpentReportV.setText(String.valueOf(vetorGastos[4].getValorGasto()));
TextView tv7stSpentReportV = (TextView) findViewById(R.id.tv7stSpentReportV);
tv7stSpentReportV.setText(String.valueOf(vetorGastos[3].getValorGasto()));
TextView tv8stSpentReportV = (TextView) findViewById(R.id.tv8stSpentReportV);
tv8stSpentReportV.setText(String.valueOf(vetorGastos[2].getValorGasto()));
TextView tv9stSpentReportV = (TextView) findViewById(R.id.tv9stSpentReportV);
tv9stSpentReportV.setText(String.valueOf(vetorGastos[1].getValorGasto()));
TextView tv10stSpentReportV = (TextView) findViewById(R.id.tv10stSpentReportV);
tv10stSpentReportV.setText(String.valueOf(vetorGastos[0].getValorGasto()));
}
}
Среднесрочный TextViews имеет М в их именах, а маленькие есть В. В переменной и в ИО.
В tv2stSpentReportM отображается текст tv2stSpentReportV и tv2stSpentReportV текст tv2stSpentReportV.
Чтобы сделать более понятным, вот код моего «Gastos.class», это то, что у меня есть в массиве vetorGastos [].
public class Gastos {
private String tipoGasto;
private double valorGasto;
public String getTipoGasto() {
return tipoGasto;
}
public void setTipoGasto(String tipoGasto) {
this.tipoGasto = tipoGasto;
}
public double getValorGasto() {
return valorGasto;
}
public void setValorGasto(double valorGasto) {
this.valorGasto = valorGasto;
}
}
Как я уже говорил вам раньше, и никто, поверьте, здесь, как PrintScreen показывая вам exacly, что я сказал. Идентификаторы верны. И что теперь? И неверующие, спасибо за удаление очков репутации, потому что вы не верите. Разверните изображение, чтобы вы могли видеть, что идентификаторы верны.
Я уже разрешаю это сейчас, просто переписываю ОДИН из идентификаторов, и он становится прав. Поэтому, если это был просто неверный идентификатор, я должен переписать два идентификатора. Я не знаю почему. но он решает проблему.
Уверены ли вы, что в макете xml нет переключателей ids? –
опубликуйте свой макет – invertigo
Учитывая опечатки в вашем вопросе, и я имею в виду это искренне, вы так же заботитесь о своем коде? 'и tv2stSpentReportV текст tv2stSpentReportV' – Simon