1. 添加UID

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.zhai.ads"
    android:sharedUserId="android.uid.system"
    android:versionCode="1"
    android:versionName="1.0.1015" >

2.代码:

long time = System.currentTimeMillis();
                        Calendar mCalendar = Calendar.getInstance();
                        mCalendar.setTimeInMillis(time);
                        mCalendar.set(Calendar.YEAR, dp1.getYear());
                        mCalendar.set(Calendar.MONTH, dp1.getMonth());
                        mCalendar.set(Calendar.DAY_OF_MONTH,
                                dp1.getDayOfMonth());
                        mCalendar.set(Calendar.HOUR, tp1.getCurrentHour());
                        mCalendar.set(Calendar.MINUTE,
                                tp1.getCurrentMinute());

                        int year = mCalendar.get(Calendar.YEAR);
                        int month = mCalendar.get(Calendar.MONTH);
                        int day = mCalendar.get(Calendar.DATE);
                        int mHour = mCalendar.get(Calendar.HOUR);
                        int mMinute = mCalendar.get(Calendar.MINUTE);

                        mCalendar.set(year, month, day, mHour, mMinute, 0);

                        long curTime = mCalendar.getTimeInMillis();
                        SystemClock.setCurrentTimeMillis(curTime);

                        showToast("设置时间成功");