Code example for ArrayAdapter

Methods: notifyDataSetChanged

0
        int i;
        NewsCategory cat = NewsSource.getInstance().getCategory(categoryIndex);
        for (i = 0; i < cat.getArticleCount(); i++) {
            mHeadlinesList.add(cat.getArticle(i).getHeadline());
        } 
        mListAdapter.notifyDataSetChanged();
    } 
 
    /** 
     * Handles a click on a headline. 
     * 
     * This causes the configured listener to be notified that a headline was selected. 
     */ 
    @Override 
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        if (null != mHeadlineSelectedListener) {
            mHeadlineSelectedListener.onHeadlineSelected(position);
        } 
    } 
 
    /** Sets choice mode for the list