Android GridView getChildAt (0) .findViewById () возвращает ноль

у меня естьGridView с некоторыми предметами я использовал специальный адаптер, который расширяетBaseAdapter, каждая строка показывает загружаемый элемент, каждая строка имеет значок, показывающий ход загрузки.

Поэтому мне нужно обновить этот значок.

Для этого обновления я знаю, что я могу изменить данные и позвонитьnotifyDataChanged() и представление будет обновляться, но этот подход стоит мне много изменений, и я не хочу этого делать.

Поэтому я попытался получить конкретного ребенка отgridview, найдите этот значок и измените значок, но возвращенное представление является нулевым.

View v = mGridView.getChildAt(0);
if(v != null)
{
    ImageButton mDownloadButton = (ImageButton)v.findViewById(R.id.download_icon_button);
    if(mDownloadButton != null)
        updateDownloadIcon(mDownloadButton, intent.getIntExtra(DATA.EXTRA_DOWNLOAD_PROGRESS, 0));
    else
        Log.e(TAG, "null image button");
}

v не нуль, ноmDownloadButton нулевой.

любая помощь будет оценена.

Обновить:

@Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        if(convertView == null)
        {
            LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
            convertView = mInflater.inflate(R.layout.all_book_frag_item_layout, null);
        }

        mBookCoverImageView = (ImageView)convertView.findViewById(R.id.bookCoverID);
        mBookNameTextView = (TextView)convertView.findViewById(R.id.bookNameID);
        mBookWriterTextView = (TextView)convertView.findViewById(R.id.bookWriterID);
        mBookOtherInfoTextView = (TextView)convertView.findViewById(R.id.bookInfoID);
        mAudioImageView = (ImageView)convertView.findViewById(R.id.audio_image);
        mVideoImageView = (ImageView)convertView.findViewById(R.id.video_image);
        mDownloadButton = (ImageButton)convertView.findViewById(R.id.download_icon_button);
        mBookSize = (TextView)convertView.findViewById(R.id.download_size);
        mBookNameInCover = (TextView)convertView.findViewById(R.id.bookNameInCover);

        sectionRow = getSectionRow(position);

        if(!mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmBookCover().equals(""))
        {
            imageLoader.DisplayImage(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmBookCover(), mBookCoverImageView);
            mBookNameInCover.setText("");
        }
        else
        {
            mBookCoverImageView.setImageResource(R.drawable.trans_icon);
            mBookNameInCover.setText(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmPostTitle());
        }

        mBookNameTextView.setText(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmPostTitle());
        mBookWriterTextView.setText(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmAuthorName());
        mBookOtherInfoTextView.setText(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getCatString());
        mBookSize.setText(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmEpubSize());

        if(isBookDownloaded(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).getmPostId()))
        {
            mDownloadButton.setImageResource(R.drawable.download_icon_90_100);
        }
        else
        {
            mDownloadButton.setImageResource(R.drawable.download_icon);
        }

        if(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).ismSound())
        {
            mAudioImageView.setVisibility(View.VISIBLE);
        }
        else
        {
            mAudioImageView.setVisibility(View.INVISIBLE);
        }

        if(mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]).ismVideo())
        {
            mVideoImageView.setVisibility(View.VISIBLE);
        }
        else
        {
            mVideoImageView.setVisibility(View.INVISIBLE);
        }

        if(mSelectsItems[sectionRow[0][0]][sectionRow[1][0]])
        {
            convertView.findViewById(R.id.allBookBaseLayout).setBackgroundResource(R.color.selection_color);
        }
        else
        {
            convertView.findViewById(R.id.allBookBaseLayout).setBackgroundResource(R.drawable.book_view_one_column_item_background);
        }

        mDownloadButton.setOnClickListener(new DownloadClickListener(mDownloadButton, mHeaderInfo.get(sectionRow[0][0]).getmBooksInCat().get(sectionRow[1][0]), position));

        return convertView;
    }

Обновление 2:

Мой адаптер реализуетStickyGridHeadersBaseAdapter а иногда это дает мне дубликат ошибки идентификатора, поэтому я установилmGridView.setId(-1);

Ответы на вопрос(2)

Ваш ответ на вопрос