Code example for SparseBooleanArray

Methods: getkeyAtsize

0
        if (v.getId() == R.id.btnLoad) {
            ListView lv = getListView();
            SparseBooleanArray a = lv.getCheckedItemPositions();
            int fstSelIndex = -1;
 
            for (int i = 0; i < a.size(); i++) {
                int key = a.keyAt(i);
                if (a.get(key)) {
                    fstSelIndex = key;
                    break; 
                } 
            } 
 
            if (fstSelIndex < 0) {
                Toast t = Toast.makeText(LoadSavedPostsActivity.this, "select item to load", 1000);
                t.show();
            } else { 
                FSDocumentReference fsref = refList.get(fstSelIndex);
                myProgressDialog = ProgressDialog.show(this, "loading", "Please wait...", true);
                DocumentLocalSvcs svc = new DocumentSvcImpl();
Contextual code suggestions in your IDE  Get Codota for Java