0

頭が良くて目が良い人は誰でも問題を解決できますか? 実行中に次のようなメッセージがスローされます。私は本当にこの問題を乗り越えることができません.お願い....

public class HourReportsAtv extends Activity implements PropertyChangeListener {
private int weekNum = -1;
private Button addBtn;
private Button prevBtn;
private Button nextBtn;
private ListView workingTimeList;
private TextView weekTotalHour;
private ListViewAdapter adapter;
private int resourceId = R.layout.custom_list_item;
private HourReportCatalog hourReportCatalog = new HourReportCatalog();
ProgressDialog progressDialog;

public HourReportsAtv() {

}

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.e("test", "");
    setContentView(R.layout.hour_report_atv);
    hourReportCatalog.addChangeListener(this);
    findAllByID();
    // hourReportCatalog =
    // (HourReportCatalog)getIntent().getSerializableExtra("dk.tcmobile.model.HourReportCatalog");
    InitializatorHourReportList task = new InitializatorHourReportList();
    task.execute();  

}
private void findAllByID() {

    addBtn = (Button) findViewById(R.id.AddWeekBtn);
    addBtn.setOnClickListener(new AddBtnListener());
    nextBtn = (Button) findViewById(R.id.NextWeekBtn);
    prevBtn = (Button) findViewById(R.id.PreviousWeekBtn);
    weekTotalHour = (TextView) findViewById(R.id.textView_HourNumber);

    prevBtn.setOnClickListener(new PreviousBtnListener());
    nextBtn.setOnClickListener(new NextBtnListener());
    workingTimeList = (ListView) findViewById(R.id.workingDaysList);

}
public void propertyChange(PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName();
    if (propertyName.equalsIgnoreCase("total")) {
        Double total = (Double) evt.getNewValue();
        String totalString = Double.toString(total);
        weekTotalHour.setText(totalString);
    }
}    


private class AddBtnListener implements OnClickListener {

    @Override
    public void onClick(View v) {
        hourReportCatalog.createNewHourReport();
    }

}

private class NextBtnListener implements OnClickListener {

    @Override
    public void onClick(View v) {
        weekNum = weekNum + 1;  
        initializeListViewAdapter(hourReportCatalog
                .getOneWeekHourReportList(weekNum));

        double t = hourReportCatalog.getTotal();    
        String totalString = Double.toString(t);
        weekTotalHour.setText(totalString);

    }

}

private class PreviousBtnListener implements OnClickListener {

    @Override
    public void onClick(View v) {
        weekNum = weekNum - 1;
        initializeListViewAdapter(hourReportCatalog
                .getOneWeekHourReportList(weekNum));

        double t = hourReportCatalog.getTotal();
        String totalString = Double.toString(t);
        weekTotalHour.setText(totalString);
    }

}

private boolean isEqual(ArrayList<HourReport> actualList,
        ArrayList<HourReport> oneWeekList) {
    boolean equal = true;

    for (int x = 0; x < actualList.size(); x++) {
        HourReport ahr = actualList.get(x);
        HourReport r = oneWeekList.get(x);
        if (!ahr.equals(r)) {
            equal = false;
            break;
        }
    }
    if (!equal) {

        return false;
    }
    return true;
}

private void initializeListViewAdapter(ArrayList<HourReport> oneWeekList) {
    adapter = new ListViewAdapter(HourReportsAtv.this, resourceId,
            oneWeekList, hourReportCatalog);
    adapter.notifyDataSetChanged();
    //workingTimeList.setAdapter(adapter);

}

private class InitializatorHourReportList extends
        AsyncTask<Void, Void, ArrayList<HourReport>> {

    @Override
    protected ArrayList<HourReport> doInBackground(Void... unused) {
        Log.e("", "doinBackgrounf");
        ArrayList<HourReport> list = new ArrayList<HourReport>();
        list = hourReportCatalog.getOneWeekHourReportList(weekNum);
        return list;
    }

    @Override
    protected void onPostExecute(final ArrayList<HourReport> list) {
        initializeListViewAdapter(list);
        double t = hourReportCatalog.getTotal();    
        String totalString = Double.toString(t);
        weekTotalHour.setText(totalString);


    }
}

}

4

2 に答える 2