This is the code for my second adapter:
package com.weinco.list;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.androidquery.AQuery;
import com.weinco.R;
import com.weinco.fragments.StandorteFragment;
import com.weinco.webservice.entity.Standort;
import com.weinco.webservice.entity.Standorts;
public class LocationMenuAdapter2 extends BaseAdapter {
private LayoutInflater mInflater;
private AQuery aQuery;
private Standorts standorts;
private Standort standort;
private StandorteFragment standorteFragment;
public LocationMenuAdapter2(StandorteFragment standorteFragment, Standorts standorts) {
this.standorteFragment =standorteFragment;
this.standorts =standorts;
this.aQuery = standorteFragment.aQuery;
mInflater = LayoutInflater.from(standorteFragment.getActivity());
}
public int getCount() {
return standorts.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public Standort getStandort(int i) {
return standorts.get(i);
}
public View getView(int position, View convertView, ViewGroup parent) {
ListContent holder = null;
Standort standort = getStandort(position);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listviewinflate, null);
holder = new ListContent();
holder.text = (TextView) convertView
.findViewById(R.id.TextView01);
convertView.setTag(holder);
} else {
holder = (ListContent) convertView.getTag();
}
if(standort.BusinessLunch==true){
holder.text.setText(standort.Name);
}
return convertView;
}
class ListContent {
TextView text;
}
}
=====================================================================
This is the function that loads the adapter:
private void loadBussinessLunchLoc() {
ServiceProxy.createWebServiceTask(getActivity(), new RemoteCallListener() {
@Override
public void onRemoteCallError(String response) {
// TODO Auto-generated method stub
}
@Override
public void onRemoteCallComplete(Object response) {
Log.d("debug", "response is = "+response+"\t"+response.getClass());
Standorts standorts = (Standorts) response;
locationMenuAdapter2 = new LocationMenuAdapter2(StandorteFragment.this, standorts);
menuItemListLoc2page.setAdapter(locationMenuAdapter2);
}
@Override
public void onNoInternetError() {
// TODO Auto-generated method stub
}
@Override
public void onNoAccess() {
// TODO Auto-generated method stub
}
}, true).invokeGetStandorte();
}
=============================================
I have a image adapter, that works, and inflates a listview into an layout of a View Flipper, i need to use the same adapter, for another listview, in another layout, but i need to use one variable of the WebEntity it inflates in the listview, so that it won't put all the web entities, and only those who have that variable true. How could i do this?Add a code snippet to your website: www.paste.org