심각도, 심각도는 ProgressBar로 표시됩니다. NAME님께 서 해당 코드가 정확하지 않습니다 : mProgress.setProgress(0);
ProgressBar가 없습니다. onCreate()에서 PreogressBar를 초기화했습니다. 당신의 도움이Android ProgressBar NPE
ListAdapter adapter = new ArrayAdapter<Dettaglio>(this, R.layout.dettaglio, R.id.tv_totale_group, dettagli){
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);
TextView tvEn, tvCaa, tvPer;
tvEn = (TextView) row.findViewById(R.id.tv_to_group);
tvCaa = (TextView) row.findViewById(R.id.tv_cat_group);
tvPer = (TextView) row.findViewById(R.id.tv_perc_cat);
ProgressBar mProgress;
mProgress = (ProgressBar) findViewById(R.id.progress_e);
mProgress.setProgress(0);
mProgress.setMax(100);
Dettaglio d = dettagli.get(position);
tvCaa.setText(d.categorie+"");
double value = Double.valueOf(d.en);
NumberFormat formatter = NumberFormat.getCurrencyInstance();
String en = formatter.format(value);
tvEn.setText(en+"");
//percent-------------------------
double totaleE = 0;
for (Dettaglio c : dettagli){
totaleE += c.en;
}
value = d.en/totaleE *100;
DecimalFormat decimalFormat = new DecimalFormat("0.#");
String en1 = decimalFormat.format(value);
tvPer.setText(en1+"%");
//----PROGRESS BAR----------------------------------------
int valore_per_barra = (int) Math.floor(value);
mProgress.setProgress(valore_per_barra);
return row;
}
};
lista.setAdapter(adapter);
어디'초기화 mProgress'되어 주셔서 감사합니다? 메소드의 – Raghunandan
onCreate() mProgress = (ProgressBar) findViewById (R.id.progress_e); – user2996988