i working baseadapter. listview가 업데이트되지 않았습니다. baseadapter
public String getDateDiffString(Date dateOne, Date dateTwo)
{
long timeOne = dateOne.getTime();
long timeTwo = dateTwo.getTime();
long oneDay = 1000 * 60 * 60 * 24;
long delta = (timeTwo - timeOne)/oneDay;
if (delta > 0) {
for (int i = 0; i < delta; i++) {
}
return String.valueOf(delta) ;
}
else {
delta *= -1;
return String.valueOf(delta);
}
}
가 날짜 시간 사이 나는 두 2014년 9월 1일 datetimeformat 09/10/2014.i 체크 일이 있고 또한 I가 변경 funtciton 쓴가 그것을 변경 형식 2014년 9월 1일를 날짜 시간 1 구월
public static String dateFormatterforLukka(String inputDate,int lenght) {
String inputFormat = "MM/dd/yyyy";
String outputFormat = String.valueOf(lenght)+"MMM";
Date parsed = null;
String outputDate = "";
try {
SimpleDateFormat df_input = new SimpleDateFormat(inputFormat,
new Locale("en", "US"));
SimpleDateFormat df_output = new SimpleDateFormat(outputFormat,
new Locale("en", "US"));
parsed = df_input.parse(inputDate);
outputDate = df_output.format(parsed);
Log.wtf("outputDate", outputDate);
} catch (Exception e) {
outputDate = inputDate;
}
return outputDate;
}
이 목록보기에서 나의 datetimes를 추가하고 싶습니다.이 시간에는 두 개의 datetimes가 있습니다. 9월 1일, 9월 2일 등 ...
BaseAdapter 코드
public class HollAdapters extends BaseAdapter {
private Context mContext;
private final ArrayList<CinemaInfoModel> hollitems;
private CinemaInfoModel objBean;
private TextView start_time,holle,time;
private static LayoutInflater inflater = null;
public HollAdapters(Context context, ArrayList<CinemaInfoModel> hollitems) {
mContext = context;
this.hollitems = hollitems;
inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return hollitems.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@SuppressLint("ViewHolder")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View grid;
grid = new View(mContext);
grid = inflater.inflate(R.layout.cinema_holl_adapter, null);
start_time = (TextView) grid.findViewById(R.id.adapter_day);
holle = (TextView) grid.findViewById(R.id.adapter_holl);
time = (TextView) grid.findViewById(R.id.adapter_time);
objBean = hollitems.get(position);
start_time.setText(objBean.getStartTime());
holle.setText(objBean.getHole());
String start_time=objBean.getTime();
start_time=start_time.replace(",", "\n");
time.setText(start_time);
return grid;
}
}
이 주요 자바 코드
SimpleDateFormat df = new SimpleDateFormat(
"MM/dd/yyyy");
Date _d = df.parse("09/01/2014");
Date _d1 = df.parse("09/10/2014");
SimpleDateFormat new_df = new SimpleDateFormat(
"d MMM");
String _s1 = new_df.format(_d1);
String datetimeis=getDateDiffString(_d1, _d);
Log.wtf("differentis ", datetimeis);
int abc=Integer.parseInt(datetimeis);
for (int l = 0; l < abc; l++) {
String ab = dateFormatterforLukka(timeJsonArray
.getJSONObject(k).getString("start_time"),l++);
Log.wtf("timeeeeeeeee", ab);
cinemaTime.setStartTime(ab);
cinemaTime.setEndTime(_s1);
cinemaTimesArray.add(cinemaTime);
}
이다 내가 내 응용 프로그램은 9월 8일 항상 추가 실행할 때 내 listview에서,하지만 로그 및 로그에 나는 different result, 목록보기가 업데이트되지 않았습니다.
무엇이 잘못 되었나요? 누구든지 해결책을 알고 있다면 나에게
notifydatasetchange()를 사용하는 곳에서 어댑터 코드를 공유하십시오. – koutuk
@koutuk 내 baseadapter 코드를 추가했습니다. – Beka