Sunday, July 3, 2011

[android-developers] Re: Modify listview item child views with adapter and getview()

Solved it like this:

listView.setOnItemClickListener(new OnItemClickListener(){

@Override
public void onItemClick(AdapterView<?> parent, View viewItem, int
position, long arg3) throws NullPointerException{

new UI(parent.getChildAt(position)).execute(null);

}});
----------------------------------------------------------------------------

private class UI extends AsyncTask <View, String, View>
{
public View viewItem=null;
public UI(View v)
{
this.viewItem=v;
}
@Override
protected View doInBackground(View... arg0) {
// TODO Auto-generated method stub
return null;
}

@Override
protected void onPreExecute() {
listView.getChildCount();
for(int i = 0; i <= listView.getChildCount(); i++)
{
if(listView.getChildAt(i)!= null)
{

(listView.getChildAt(i).findViewById(R.id.gotherefav)).setVisibility(View.INVISIBLE);

(listView.getChildAt(i).findViewById(R.id.removefav)).setVisibility(View.INVISIBLE);

}
}

super.onPreExecute();
}

@Override
protected void onPostExecute(View result) {

((Button)viewItem.findViewById(R.id.gotherefav)).setVisibility(View.VISIBLE);

((Button)viewItem.findViewById(R.id.removefav)).setVisibility(View.VISIBLE);
ime=((TextView)viewItem.findViewById(R.id.item)).getText();
super.onPostExecute(result);
}

}
----------------------------------------------------------
Without invoking getView() and repopulating the list
No I have to reduce the time for parsing the xml, I mean reduce the
usage of findViewById somehow.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment