マシンでアプリの起動時々異常終了こと

アプリを起動するとき、リードデータは時間がかかりましたが、ProgressBarを使っていました

listviewの初期化はメッド「initialize()」で入れって、VX100マシンでアプリ起動時、時々異常終了となってしまう。(模擬器でOKでした)

下記のCustomerBasic修正前にコーディング。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    /**
     * initialize CustomerInformation
     */
    private void initialize() {
        res = new Res(this);
        masterDB=MasterDB.getInstance(this);
        //create empty table
        table=masterDB.createTable();
        //initialize row
        rightListViewRow=new Row(masterDB.getColumnList());
        List<String> columnName=new ArrayList<String>();
        columnName.add(MasterDB.FIELD_FUNKEYCODE1);
        columnName.add(MasterDB.FIELD_FUNKEYTYPE1);
        rightListViewRow.setUnshowColumn(columnName);
        barcodeFlag=rightListViewRow.getColumn(MasterDB.FIELD_SCANCODE1).getFlag();
        //initialize button
        initButton();
        //initialize listview
        initLIstView();
        //initialize conditionDialog's information
        initConditionDialogInformation();
        //最大件数の判定
        if(masterDB.isRecordCountExceed(MAX_COUNT)==true){
                showConfirmDialog(res.getString(Res.ERR_ERRORTITLE),res.getString(Res.ERR_COUNTEXCEED_MSG),"",R.id.buttonClose);
                return;
        }
        showLoadProgress(ZERO);
    }

修正方法は、ProgressBarのメソッド「onProgressBarResult(……)」の下に入れる。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 @Override
    public void onProgressBarResult(int calledByViewId) {
        switch (calledByViewId) {
        case Function.DISCOUNT:
            selectRow();
            break;
        case R.id.buttonSearch:
            if (searchCondition.getArgs().size() == ZERO) {
                updateTextView(R.id.textViewRecordCountTitle, res.getString(Res.TEXT_ALL));
            } else {
                updateTextView(R.id.textViewRecordCountTitle, res.getString(Res.TEXT_SEARCHRESULTS));
            }

            if (table.getRowCount() == 0) {
                updateTextView(R.id.textViewDiscount, "");

                showConfirmDialog(calledByViewId, res.getString(Res.TEXT_SEARCHRESULTS), res.getString(Res.ERR_COND_MSG), "");
            }

            listViewLeftAdapter.notifyDataSetChanged();
            listViewLeft.moveToTopPage();

            updateTextView(R.id.textViewRecordCount, String.valueOf(table.getRowCount()));

            onAction();
            viewMap.get(R.id.buttonSearch).setVisibility(View.VISIBLE);
            break;
        case ZERO:
            //------------------------ここに入れる--------------------------------↓
            // initialize the list view
            initListView();
            //--------------------------------------------------------------------↑

            // initialize the list bar
            initListBar();

            updateTextView(R.id.textViewRecordCount, String.valueOf(table.getRowCount()));

            onAction();
            break;
        case CUSTOMER_ADD:
            updateRightListView();
            updateTextView(R.id.textViewDiscount, "");
            break;
        default:
            break;
        }
    }