- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个自定义日历,是根据看到的那个修改的 here .在初始加载时,它会按预期显示所有内容。
但是我有两个问题。
1.) 在上个月按钮上,它会按预期从八月到七月,但不会清除所有图像。
2.) 从 7 月到 8 月,它停留在 7 月并重新安排日期。
基础适配器:
public class CalendarAdapter extends BaseAdapter {
private Context mContext;
private java.util.Calendar month;
public GregorianCalendar pmonth; // calendar instance for previous month
public GregorianCalendar pmonthmaxset;
private GregorianCalendar selectedDate;
public static List<String> dayString;
private List<String[]> anArrayOfStrings = new ArrayList<String[]>();
int firstDay, maxWeeknumber, maxP, calMaxP, lastWeekDay, leftDays, mnthlength;
String itemvalue, curentDateString;
DateFormat df;
ImageView mimgPeriod, mimgEnergy, mimgIntercorse, mimgPregancy, mimgHeadache, mimgMood;
DateFormat formatter;
Date rowdatetemp;
Date caldatetemp;
String box;
private int mHeight = 0;
private int mWidth = 0;
public CalendarAdapter(Context c, GregorianCalendar monthCalendar) {
CalendarAdapter.dayString = new ArrayList<String>();
Locale.setDefault( Locale.US );
month = monthCalendar;
selectedDate = (GregorianCalendar) monthCalendar.clone();
mContext = c;
month.set(GregorianCalendar.DAY_OF_MONTH, 1);
new ArrayList<String>();
df = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
curentDateString = df.format(selectedDate.getTime());
refreshDays();
box = null;
}
public void setItems(List<String[]> anArrayOfStrings) {
this.anArrayOfStrings = anArrayOfStrings;
}
public int getCount() {
return dayString.size();
}
public Object getItem(int position) {
return dayString.get(position);
}
public long getItemId(int position) {
return 0;
}
// create a new view for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
TextView dayView;
if (convertView == null) { // if it's not recycled, initialize some
// attributes
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.calendar_item, null);
}
dayView = (TextView) v.findViewById(R.id.date);
// separates daystring into parts.
String[] separatedTime = dayString.get(position).split("-");
// taking last part of date. ie; 2 from 2012-12-02
String gridvalue = separatedTime[2].replaceFirst("^0*", "");
// checking whether the day is in current month or not.
if ((Integer.parseInt(gridvalue) > 1) && (position < firstDay)) {
// setting offdays to white color.
dayView.setTextColor(Color.WHITE);
dayView.setClickable(false);
dayView.setFocusable(false);
} else if ((Integer.parseInt(gridvalue) < 7) && (position > 28)) {
dayView.setTextColor(Color.WHITE);
dayView.setClickable(false);
dayView.setFocusable(false);
} else {
// setting curent month's days in blue color.
dayView.setTextColor(Color.BLUE);
}
dayView.setText(gridvalue);
//create date string for comparison
String date = dayString.get(position);
if (date.length() == 1) {
date = "0" + date;
}
String monthStr = "" + (month.get(GregorianCalendar.MONTH) + 1);
if (monthStr.length() == 1) {
monthStr = "0" + monthStr;
}
//look in the hashtable in order to find the position date and then populate the img's
if ((anArrayOfStrings != null) && (anArrayOfStrings.size() > 0)) {
if (formatter == null) {
formatter = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
}
Log.i("PROJECTCARUSO","Date: " + date);
for (String[] row : anArrayOfStrings) {
//convert date's
try {
caldatetemp = (Date)formatter.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
try {
rowdatetemp = (Date)formatter.parse(row[0]);
} catch (ParseException e) {
e.printStackTrace();
}
// current position date in calendar
// array date is after the calendar date
if (rowdatetemp.after(caldatetemp)) {
break;
//current position date > first array date then continue to see if there is one for this date
} else if (rowdatetemp.before(caldatetemp)) {
continue;
//Found a match
} else if (date.equalsIgnoreCase(row[0])) {
for (int i = 1; i < row.length; i++) {
Log.i("PROJECTCARUSO","row[" + i +"]: " + row[i]);
//Now that we have a match look through each detail
if ( row[i]!= null ) {
if ((i == 1) && ((row[i].equalsIgnoreCase("yes")) || (isNumeric(row[i])))) {
mimgPeriod = (ImageView) v.findViewById(R.id.imgPeriod);
setVisible(v, mimgPeriod);
mimgPeriod.setImageAlpha(100);
box = "red";
continue;
}
if ((i == 2) && ((row[i].equalsIgnoreCase("yes")) || (isNumeric(row[i])))) {
mimgIntercorse = (ImageView) v.findViewById(R.id.imgIntercorse);
setVisible(v, mimgIntercorse);
mimgIntercorse.setImageAlpha(100);
continue;
}
if ((i == 4) && ((row[i].equalsIgnoreCase("yes")) || (isNumeric(row[i])))) {
mimgHeadache = (ImageView) v.findViewById(R.id.imgHeadache);
setVisible(v, mimgHeadache);
mimgHeadache.setImageAlpha(100);
continue;
}
if ((i == 5) && ((row[i].equalsIgnoreCase("yes")) || (isNumeric(row[i])))) {
mimgPregancy = (ImageView) v.findViewById(R.id.imgPregancy);
setVisible(v, mimgPregancy);
mimgPregancy.setImageAlpha(100);
continue;
}
}
if (( row[i]!= null ) && (i == 6) && (!row[i].equalsIgnoreCase("no"))) {
mimgEnergy = (ImageView) v.findViewById(R.id.imgEnergy);
setImg(v, mimgEnergy, row[i].toString());
setVisible(v, mimgEnergy);
continue;
}
if (( row[i]!= null ) && (i == 3) && (!row[i].equalsIgnoreCase("no"))) {
mimgMood = (ImageView) v.findViewById(R.id.imgMood);
setImg(v, mimgMood, row[i].toString());
setVisible(v, mimgMood);
continue;
}
if (( row[i]!= null ) && (i == 7) || (box != null)) {
if (box == null) {
if (row[i].equalsIgnoreCase("no")) {
box = "brown";
} else {
box = "yellow";
}
}
Drawable []layers = new Drawable [2];
int imageResource1 = mContext.getResources().getIdentifier("drawable/calendar_cell", null, mContext.getPackageName());
Drawable background = v.getResources().getDrawable(imageResource1);
layers [0]= background;
int imageResource = mContext.getResources().getIdentifier("drawable/box_" + box, null, mContext.getPackageName());
Drawable boxImg = v.getResources().getDrawable(imageResource);
boxImg.setAlpha(100);
layers [1]= boxImg;
LayerDrawable layerDrawable = new LayerDrawable (layers);
mWidth = v.getWidth();
mHeight=v.getHeight();
v.getLayoutParams().height = mHeight;
v.getLayoutParams().width = mWidth;
v.setBackground(layerDrawable);
//reset
box = null;
continue;
}
}
} else {
break;
}
}
} else {
Log.i("PROJECTCARUSO","RESETING VIEWS TO INVISIBLE");
mimgMood = (ImageView) v.findViewById(R.id.imgMood);
mimgEnergy = (ImageView) v.findViewById(R.id.imgEnergy);
mimgPregancy = (ImageView) v.findViewById(R.id.imgPregancy);
mimgHeadache = (ImageView) v.findViewById(R.id.imgHeadache);
mimgIntercorse = (ImageView) v.findViewById(R.id.imgIntercorse);
mimgPeriod = (ImageView) v.findViewById(R.id.imgPeriod);
setInvisibleVisible(v, mimgMood);
setInvisibleVisible(v, mimgEnergy);
setInvisibleVisible(v, mimgPregancy);
setInvisibleVisible(v, mimgHeadache);
setInvisibleVisible(v, mimgIntercorse);
setInvisibleVisible(v, mimgPeriod);
}
//clear the array after using it.
//anArrayOfStrings.clear();
return v;
}
public View setVisible(View view, ImageView iv) {
iv.setVisibility(View.VISIBLE);
return view;
}
public View setInvisibleVisible(View view, ImageView iv) {
iv.setVisibility(View.INVISIBLE);
return view;
}
public View setImg(View view, ImageView iv, String mood) {
iv.setImageAlpha(100);
iv.setVisibility(View.VISIBLE);
int draw = mContext.getResources().getIdentifier("drawable/" + mood, null, mContext.getPackageName());
iv.setImageResource(draw);
return view;
}
public void refreshDays() {
// clear items
anArrayOfStrings.clear();
dayString.clear();
Locale.setDefault( Locale.US );
pmonth = (GregorianCalendar) month.clone();
// month start day. ie; sun, mon, etc
firstDay = month.get(GregorianCalendar.DAY_OF_WEEK);
// finding number of weeks in current month.
maxWeeknumber = month.getActualMaximum(GregorianCalendar.WEEK_OF_MONTH);
// allocating maximum row number for the gridview.
mnthlength = maxWeeknumber * 7;
maxP = getMaxP(); // previous month maximum day 31,30....
calMaxP = maxP - (firstDay - 1);// calendar offday starting 24,25 ...
pmonthmaxset = (GregorianCalendar) pmonth.clone();
pmonthmaxset.set(GregorianCalendar.DAY_OF_MONTH, calMaxP + 1);
for (int n = 0; n < mnthlength; n++) {
itemvalue = df.format(pmonthmaxset.getTime());
pmonthmaxset.add(GregorianCalendar.DATE, 1);
dayString.add(itemvalue);
}
}
private int getMaxP() {
int maxP;
if (month.get(GregorianCalendar.MONTH) == month
.getActualMinimum(GregorianCalendar.MONTH)) {
pmonth.set((month.get(GregorianCalendar.YEAR) - 1),
month.getActualMaximum(GregorianCalendar.MONTH), 1);
} else {
pmonth.set(GregorianCalendar.MONTH,
month.get(GregorianCalendar.MONTH) - 1);
}
maxP = pmonth.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
return maxP;
}
@SuppressWarnings("unused")
public static boolean isNumeric(String str)
{
try
{
double d = Double.parseDouble(str);
}
catch(NumberFormatException nfe)
{
return false;
}
return true;
}
}
日历:
public class CalendarFragment extends Fragment {
public GregorianCalendar month;// calendar instances.
public CalendarAdapter adapter; // adapter instance
public Handler handler; // for grabbing some event values for showing the dot
// marker.
public ArrayList<String> items; // container to store calendar items which
// needs showing the event marker
int i;
List<String[]> anArrayOfStrings = new ArrayList<String[]>();
String startdate, enddate;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_calendar, null);
month = (GregorianCalendar) GregorianCalendar.getInstance();
month.set(Calendar.DAY_OF_MONTH, 1-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
//start date for cursor
startdate = df.format(month.getTime());
//end date
month.add(Calendar.MONTH, 1);
month.add(Calendar.DAY_OF_MONTH, +5);
enddate = df.format(month.getTime());
month.add(Calendar.MONTH, -1);
Locale.setDefault( Locale.US );
month = (GregorianCalendar) GregorianCalendar.getInstance();
items = new ArrayList<String>();
adapter = new CalendarAdapter(getActivity(), month);
GridView gridview = (GridView) view.findViewById(R.id.gridview);
gridview.setAdapter(adapter);
handler = new Handler();
handler.post(calendarUpdater);
TextView title = (TextView) view.findViewById(R.id.title);
title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
RelativeLayout previous = (RelativeLayout) view.findViewById(R.id.previous);
previous.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setPreviousMonth();
refreshCalendar();
}
});
RelativeLayout next = (RelativeLayout) view.findViewById(R.id.next);
next.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setNextMonth();
refreshCalendar();
}
});
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
String selectedGridDate = CalendarAdapter.dayString
.get(position);
String[] separatedTime = selectedGridDate.split("-");
String gridvalueString = separatedTime[2].replaceFirst("^0*",
"");// taking last part of date. ie; 2 from 2012-12-02.
int gridvalue = Integer.parseInt(gridvalueString);
// navigate to next or previous month on clicking offdays.
if ((gridvalue > 10) && (position < 8)) {
setPreviousMonth();
refreshCalendar();
} else if ((gridvalue < 7) && (position > 28)) {
setNextMonth();
refreshCalendar();
}
}
});
return view;
}
protected void setNextMonth() {
if (month.get(GregorianCalendar.MONTH) == month
.getActualMaximum(GregorianCalendar.MONTH)) {
month.set((month.get(GregorianCalendar.YEAR) + 1),
month.getActualMinimum(GregorianCalendar.MONTH), 1);
} else {
month.set(GregorianCalendar.MONTH,
month.get(GregorianCalendar.MONTH) + 1);
}
}
protected void setPreviousMonth() {
if (month.get(GregorianCalendar.MONTH) == month
.getActualMinimum(GregorianCalendar.MONTH)) {
month.set((month.get(GregorianCalendar.YEAR) - 1),
month.getActualMaximum(GregorianCalendar.MONTH), 1);
} else {
month.set(GregorianCalendar.MONTH,
month.get(GregorianCalendar.MONTH) - 1);
}
}
public void refreshCalendar() {
TextView title = (TextView) getActivity().findViewById(R.id.title);
adapter.refreshDays();
adapter.notifyDataSetChanged();
handler.post(calendarUpdater); // generate some calendar items
title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
}
public Runnable calendarUpdater = new Runnable() {
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
//start date for cursor
month.add(Calendar.DAY_OF_MONTH, -1);
startdate = df.format(month.getTime());
//end date
month.add(Calendar.MONTH, 1);
enddate = df.format(month.getTime());
month.add(Calendar.MONTH, -1);
anArrayOfStrings.clear();
// Get the data
Cursor c = getActivity().getContentResolver().query(StatusProvider.CONTENT_URI_CHARTING, null, "? < " + StatusData.KEY_CHARTING_DATE + " AND ? > " + StatusData.KEY_CHARTING_DATE , new String[] {startdate, enddate}, StatusData.KEY_CHARTING_DATE + " ASC");
c.moveToFirst();
while(c.isAfterLast() == false){
anArrayOfStrings.add( new String [] {c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_DATE)),
c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_PERIOD)), c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_INTERCORSE)),
c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_MOOD)), c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_HEADACHE)),
c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_TEST)), c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_ENERGY)),
c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_FERTILE) )});
Log.i("PROJECTCARUSO","DATE ADDED TO ARRAY:" + c.getString(c.getColumnIndex(StatusData.KEY_CHARTING_DATE)));
i+=1;
c.moveToNext();
}
adapter.setItems(anArrayOfStrings);
adapter.notifyDataSetChanged();
}
};
}
日历项.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/calendar_cell"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textColor="#0000D7"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imgPeriod"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/period"
android:visibility="invisible"/>
<ImageView
android:id="@+id/imgIntercorse"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/intercorse"
android:visibility="invisible" />
<ImageView
android:id="@+id/imgPregancy"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/pregnancy"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imgEnergy"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/energy_1"
android:visibility="invisible" />
<ImageView
android:id="@+id/imgHeadache"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/pregnancy"
android:visibility="invisible" />
<ImageView
android:id="@+id/imgMood"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/mood"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
fragment 日历.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/calendar_top" >
<RelativeLayout
android:id="@+id/previous"
android:layout_width="40dip"
android:layout_height="30dip"
android:layout_alignParentLeft="true" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/arrow_left" />
</RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dip"
android:textColor="#000000"
android:textSize="18dip"
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/next"
android:layout_width="40dip"
android:layout_height="30dip"
android:layout_alignParentRight="true" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/arrow_right" />
</RelativeLayout>
</RelativeLayout>
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:listSelector="@android:color/transparent"
android:numColumns="7"
android:stretchMode="columnWidth" />
</LinearLayout>
最佳答案
第一个修复:我没有重置背景。所以这修复了那部分。现在,上个月的 View (日期)不会重新填充。
//set background
int imageResource = mContext.getResources().getIdentifier("drawable/calendar_cell", null, mContext.getPackageName());
Drawable orgImg = v.getResources().getDrawable(imageResource);
v.setBackground(orgImg);
第二个修复:重复使用日历对象会丢弃您的日历。创建一个新的日历对象,这样它们就不会相互冲突。
关于android - 自定义日历和日历适配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17889878/
我想知道是否有一种简单的方法可以为网站制作自上而下的列表日历。我不想使用谷歌日历。我还希望日历像接下来的 5 个事件一样显示并隐藏其余事件,直到显示的 5 个事件已经发生。如果有办法用 jquery
我使用的是 Drupal 日历,它在除 IE7 之外的所有浏览器中都运行良好。在 IE7 中,不会呈现单个日历条目。 奇怪的是,如果页面加载缓慢,那么正确着色的表格单元格会出现然后消失。 这是我尝试过
我已经广泛使用了原型(prototype),并且不想添加像 YUI 这样的额外框架。 我需要一个 JavaScript 日历,它使我能够逐个单元格地自定义日历单元格的呈现。 (用于渲染特定日期的事件、
通过 Google API 浏览器,我可以使用日历 ID 访问我的公共(public)日历事件列表。所以我知道这是对的 https://developers.google.com/google-app
我是 CakePHP 的新手,想使用这个框架创建一个日历。我遇到了困难,想知道是否有关于如何使用 CakePHP 创建简单日历的教程或指南? 最佳答案 这里有两个链接:LINK1 (日历助手)和 LI
我正在寻找一个与 jquery week calendar 具有相同功能的 jquery 日历 我浏览了某些日历,但它们不包含jquery周日历的资源 这可能是一个愚蠢的问题,但我可以修改jquery
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我想问一下我是否可以将日历“移动”到页面的右侧?因为我意识到它只能显示在左手边。我真的不知道如何将它“移动”到右侧...我也不知道如何放入 css 来做到这一点。 这是制作日历的代码... //
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我正在构建一个月份列表,用作 JSP 中表格的标题。 我正在做的是比较我从数据库中获得的月份,并一直迭代或“尝试”到那个月。在这种情况下,月份是 11 月 问题是我只能从 2012 年 10 月到 2
我将开发一个支持多种语言的日历解决方案,但我不确定应该如何根据各个国家/地区的用户需要来管理和显示所有不同的假期信息? 有没有地方提供世界假期信息,以便我可以解析和显示?如果没有,您会推荐更好的开发方
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我试图让我的应用程序隐藏周末,我的日历存储在一个字符串中,然后打印到innerHTML。我该如何隐藏周六和周日。 我的日历打印如下: 周日周一周二周三周四周五周六 代码: calendarString
日历有可能从星期一开始吗?我在教程中找到了这个,但我的 JS 知识还不够。我改变了一些值但没有成功。 function Calendar(id, year, month) { var elem
我正在创建一个使用 iCal 格式日历的应用程序,很可能由 Google 存储在 Google 日历中。 实现这一目标的最佳方法是什么?我真的不想在 iOS 日历应用程序中导入我的日历。 我应该解决重
在应用程序中,我使用星期几来打开成就。 let date = Date() let dateFormatter = DateFormatter() dateFormatter.dateFormat =
我正在尝试在java中为日历对象设置自定义日期和时间。我必须创建一个比当前日期多 1 天的日期,并且时间应设置为“X”(例如 05:00:00)。 这是我到目前为止所做的: Calendar tomo
while (r.next()) { String rn = r.getString(3); String sqldate = r.getString(2); // database
我有一个日历,其中突出显示了一些日期 它工作得很好,直到我想突出显示 2013 年 3 月 31 日之后的日期。此后日期就正常显示。 有人知道为什么会这样吗? 这是我用来突出显示日期的代码 //
关于报警管理器的问题我有这个代码 Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, 5); Intege
我是一名优秀的程序员,十分优秀!