我已经为android时代广场实现了代码,但是当月份发生变化时我无法检测到该事件.I have to highlight multiple range of dates from months
.
这是我已经完成的方式但是,我无法检测滚动时月份何时更改
码:
public class Calender extends Activity implements OnDateChangeListener,CalendarCellDecorator {
String BOOKING_URL="http://www.example.com/app/webroot/mobile/booking.php";
ArrayList<String>list=new ArrayList<String>();
CalendarPickerView calender;
ArrayList<Date> dates = new ArrayList<Date>();
Calendar lastYear,nextYear;
Calendar today;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.calender);
getActionBar().setTitle("CALENDER");
getActionBar().setIcon(R.drawable.back);
getActionBar().setDisplayOptions(getActionBar().getDisplayOptions()| ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView imageView = new ImageView(getActionBar().getThemedContext());
imageView.setScaleType(ImageView.ScaleType.CENTER);
imageView.setImageResource(R.drawable.manu_btn);
ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,ActionBar.LayoutParams.WRAP_CONTENT, Gravity.RIGHT| Gravity.CENTER_VERTICAL);
layoutParams.rightMargin = 40;
imageView.setLayoutParams(layoutParams);
getActionBar().setCustomView(imageView);
centerActionBarTitle();
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { …
Run Code Online (Sandbox Code Playgroud) 我尝试解析一个带有日期的字符串,将其转换为日期格式.字符串采用以下格式.
2016年3月30日00:00:00 GMT + 2016年5月30日
但是当我解析字符串我得到一个错误说,
java.text.ParseException:Unparseable date:"Wed Mar 30 00:00:00 GMT + 05:30 2016"(偏移4)
下面是我的代码的一部分.我该如何避免这个错误?任何帮助,将不胜感激.
SimpleDateFormat sdf3 = new SimpleDateFormat("EEE MM dd kk:mm:ss zzzz yyyy",Locale.ENGLISH);
for(int i=0 ; i <jArr.length() ; i++){
String tempDate = jArr.get(i).toString();
dateList.add(tempDate);
}
try{
Date d1 = sdf3.parse(dateList.get(0));
}catch (Exception e){ e.printStackTrace(); }
Run Code Online (Sandbox Code Playgroud)