所以我有一个字符串数组。我尝试将字符串数组中的每个单独项传递给自定义适配器。我很难弄清楚如何使用我在自定义适配器中传递的字符串?
我传递的String[]
 String favorites = String.valueOf(FavList.get(0).get("favorites_list"));
                String[] separated = favorites.split(",");
                for (String s: separated) {
                    //Do your stuff here
                    FavoritesAdapter.add(s);
                }Adapter.class
public class FavoritesAdapter extends ArrayAdapter<favoriteList> {
private final Context mContext;
private List<favoriteList> favlist;
private TextView favorites;
private TextView favDetail;
public FavoritesAdapter(Context context, ArrayList<favoriteList> objects) {
    super(context, R.layout.favorites_listview_single, objects);
    this.mContext = context;
    this.favlist = objects;
}
public View getView(final int position, View convertView, final ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater mLayoutInflater = LayoutInflater.from(mContext);
        convertView = mLayoutInflater.inflate(R.layout.favorites_listview_single, null);
    }
   // Here is where i cant figure out how to get the string that I passed.
    return convertView;
}}
https://stackoverflow.com/questions/38401201
复制相似问题