마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ListView BaseAdapter 갱신이 잘안됩니다

0 추천
listview를 이용해서 BaseAdapter에 글자 리스트와 그림리스트를 나타내주는 어플을 만드는 중인데

글자들은 리스트에 잘표현이 되는데 그림이 잘 갱신이 안됩니다

리스트의 스크롤을 움직여야 그림이 잘 표현이됩니다

분명히 notifyDataSetChanged()함수를 사용했는데도 그림들은 어쩔때는 잘 표현이 되고 어떻때는 액션(리스트뷰의 스크롤)을 취해야지 보여집니다

도대체 왜 그럴까요?
헨씀히포 (3,660 포인트) 님이 2014년 12월 5일 질문
어떻게 그림을 불러왔고, 셋팅했고, noti 했는지 코드를 보여주세요.

질문만으로는 답변이 한계가 있네요 ^^
private void TimerCreate(){
        int period = 100;
        timer = new Timer();
        timer.schedule(new second(), 0, period);
       
    }
    class second extends TimerTask         {   
        @Override
        public void run()
        {
            RunnableUpdate();
       
        }
    };  
    protected void RunnableUpdate() {
        Runnable updater = new Runnable()
        {            
            public void run()
            {     
                if(currentTotalCount >= totalDataCnt){
                    Log.i(null, currentTotalCount + ">="+ totalDataCnt);
                    TimerCancel();
                    mAdapter.notifyDataSetChanged();
                    return;
                }
                try {
                    try{
                        mTweetList.add(new TestListItem(Address, RoomType, price, Content, ArticlePhoto1, Article_PK_ID));
                        mAdapter.notifyDataSetChanged();
                    }catch(Exception e){
                       
                    }
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                //pensionList.setAdapter(new PensionListAdapter(MainActivity.this, pensionItem, R.layout.list_item));   
                currentTotalCount++;
                listCurrentCount++;
            }
        };
        handler.post(updater);
    }
       
    class AccumulateTask extends AsyncTask<Integer, Integer, Integer> {
        protected void onPreExecute() {

        }

        protected Integer doInBackground(Integer... params) {
                int id = params[0];
                int listPos = params[1];
             int pSw = params[2];
             try{
                 String fileName = temp_imgpath[id];
                 
                 String imagePath =  MainActivity.webUrl+"/Upload/Room/"+ fileName;
                 
                 BitmapFactory.Options resizeOpts = new Options();
                 resizeOpts.inSampleSize = 5;      
                 resizeOpts.inJustDecodeBounds = false;
                 resizeOpts.inPurgeable = true;
                InputStream is = new URL(imagePath).openStream();
                Bitmap bit = BitmapFactory.decodeStream(is,null, resizeOpts);
//                PensionListItem  Item = (PensionListItem)pensionItem.get(id);
                RoomListItem  Item = (RoomListItem)mTweetList.get(listPos);

                if(pSw == 0){
                    Bitmap  bmap = mCommon.overlayMark(bit, worterMark, 100, 100);
                    Item.setImageBitmap(bmap);
                    bmap = null;
                }else{
                    Item.setImageBitmap(bit);
                   
                }
               
               
                bit = null;
                is.close();
                bit.recycle();
                resizeOpts =  null;
                Item = null;
                 
             }catch(Exception e){
                 Log.i(null, "imageErr = "+listPos);
             }catch(OutOfMemoryError e){
                 
             }
            return 0;
        }
        protected void onProgressUpdate(Integer... progress) {         
             //dialog.progressDialogClose();
        }
        
        protected void onPostExecute(Integer result) {
           
        }
        
        protected void onCancelled() {
            //dialog.progressDialogClose();

        }

    }
   
   

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        TimerCancel();
    }




    void TimerCancel(){
        try{
        //    progressBar.setVisibility(View.INVISIBLE);
            timer.cancel();
            timer = null;
            ImageTimer.cancel();
            ImageTimer = null;
        }catch(Exception e){
           
        }
    }   
위와 같이 햇는데 어떨때는 그림이 다 나타나고 어떨대는 그림이 몇개씩 나타나지 않아요 스클롤을 아래로 내렷다가 올리면 그림이 보입니다
살려주세요

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...