Code example for SparseArray

Methods: indexOfValue, keyAt

0
        requestForQuizzes(); 
    } 
 
    protected void onListItemClick(ListView l, View v, int position, long id) {
        String item = (String) getListAdapter().getItem(position);
        int quizId = mQuizzes.keyAt(mQuizzes.indexOfValue(item));
 
        Intent intent = new Intent(this, ShowQuizActivity.class);
        intent.putExtra("quizId", quizId);
        startActivity(intent);
    } 
 
    private void requestForQuizzes() { 
        new FetchQuizzes().execute(this);
        // new ProxyQuizzes().execute(this); 
    } 
 
    // public void taskSucceeded(Object result, ProxyQuizzes proxyQuizzes) { 
    // 
    // JSONArray jarray = (JSONArray) result; 
    // String[] labels;