我有一串格式为September 27, 2016
的日期。我如何将其与今天的日期进行比较,以便我能在几天内得到差异?
答案 0 :(得分:0)
public class ImageGridAdapter extends BaseAdapter{
private Context mContext;
private int mIconSize;
private static LayoutInflater inflater=null;
AdapterCallback callback;
public interface AdapterCallback{
void onItemClicked(int position);
}
private String[] web = {
"Doctors","Movies","Dentists","Restaurants","Car"} ;
private int[] imageId = {
R.mipmap.doctors,
R.mipmap.dentists,
R.mipmap.restaurants,
R.mipmap.carmechanic,
R.mipmap.ic_launcher
};
public ImageGridAdapter(Context mContext, int mIconSize, AdapterCallback callback) {
super();
this.callback = callback;
this.mContext = mContext;
this.mIconSize = mIconSize;
inflater = ( LayoutInflater )mContext.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return imageId.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public class Holder
{
CheckBox ck;
ImageView img;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder=new Holder();
View rowView;
rowView = inflater.inflate(R.layout.sell_main_images, null);
holder.ck=(CheckBox) rowView.findViewById(R.id.chk1);
holder.img=(ImageView) rowView.findViewById(R.id.imageView1);
holder.ck.isChecked();
holder.img.setImageResource(imageId[position]);
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// How do I introduce a callback to Fragment class with the item reference that has been clicked so that capture/loading images can be performed from the Fragment class?
if(callback != null) {
callback.onItemClicked(position);
}
}
});
return rowView;
}
}