从基本适配器中的viewholder的特定条目更改特定textview

时间:2014-06-15 14:23:53

标签: android listview baseadapter

这里我有一个截面过滤列表视图,其中包含图像存在文本和大量内容,现在我正在监听其中的Presence更改,因此我不想清除()整个列表重新填充它仅用于1个存在更改。换句话说,我想从我列表的Viewholder的特定textview中选择一个TextView的方法,你能帮我,我该怎么做?这是我的适配器的一部分:

  public PinnedHeaderAdapter(Context context, ArrayList<String> 
listItems,ArrayList<Integer> listSectionPos) {
    this.mContext = context;
    this.mListItems = listItems;
    this.mListSectionPos = listSectionPos;

    mLayoutInflater = (LayoutInflater) 
 mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

@Override
public int getCount() {
    return mListItems.size();
}

@Override
public boolean areAllItemsEnabled() {
    return false;
}

@Override
public boolean isEnabled(int position) {
    return !mListSectionPos.contains(position);
}

@Override
public int getViewTypeCount() {
    return TYPE_MAX_COUNT;
}

@Override
public int getItemViewType(int position) {
    return mListSectionPos.contains(position) ? TYPE_SECTION : TYPE_ITEM;
}

@Override
public Object getItem(int position) {
    return mListItems.get(position);
}

@Override
public long getItemId(int position) {
    return mListItems.get(position).hashCode();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;



     if (convertView == null) {
        holder = new ViewHolder();
        int type = getItemViewType(position);

        switch (type) {
        case TYPE_ITEM:
            convertView = mLayoutInflater.inflate(R.layout.row_view, 
  null);
             holder.imageview  = 
 (ImageView)convertView.findViewById(R.id.imageView3);
             holder.textviewpresence  = 
 (TextView)convertView.findViewById(R.id.presence);
             String name=mListItems.get(position).toString();
             String namer[] = name.split("\\@");
             String imagenamer=namer[0];

        //   String imagenamer= mListItems.get(position).toString();


             File file = new File("storage/sdcard/LifeMatePrivate
  /ProfileImage/ProfileImage,imagechange_1,"+imagenamer+".jpg");
         if (file.exists()){

             System.out.println("exists");
           //  holder.imageview.setImageURI(uri1);

            // Picasso.with(mContext)
            //  .load(uri1)
            //  .resize(70, 70)
            //  .centerCrop()
            //  .into(holder.imageview);
             Picasso.with(mContext).load(new File("storage/sdcard/LifeMatePrivate
 /ProfileImage/ProfileImage,imagechange_1,"+imagenamer+".jpg")).resize(70, 

 70).centerCrop().into(holder.imageview);


         }else{

             Picasso.with(mContext).load(new File("storage/sdcard
 /LifeMatePrivate/ProfileImage/Default.jpg")).resize(70, 
 70).centerCrop().into(holder.imageview);
            System.out.println("storage/sdcard/LifeMatePrivate
 /ProfileImage/ProfileImage,imagechange_1,"+imagenamer+".jpg"+"didnt exist"); 


         }

         XMPPConnection connection= MyService.connection;
         Roster roster = connection.getRoster();
         Presence entryPresence = roster.getPresence(imagenamer+"@reza-
 hp");
         Presence.Type pres = entryPresence.getType();

              if (pres == Presence.Type.available){
                  holder.textviewpresence.setText("Online");
              }

             break;
        case TYPE_SECTION:
            convertView = 
 mLayoutInflater.inflate(R.layout.section_row_view, null);
            break;
        }
        holder.textView = (TextView) 
 convertView.findViewById(R.id.row_title);
        convertView.setTag(holder);


    } else {
        holder = (ViewHolder) convertView.getTag();
    }



    holder.textView.setText(mListItems.get(position).toString());

    return convertView;
}

在我想要的SQL语言中,UPDATE textview FROM mylist WHERE getView.tag()= name:D

0 个答案:

没有答案