我正在尝试更改我的 google 日历代码的输出日期格式,但它不能在 SimpleDateFormater 中使用,因为它是一个 google api 日期,而不是 java 版本。
我确实让它工作了,但最终删除了该代码,因为它总是返回 null。
我的应用程序活动将其显示为“(我的事件)在 Null 上”,我的事件将在其中更新,但日期始终返回 null。
我不擅长使用 googles API 并且我是 Java 新手,所以任何帮助将不胜感激!
这是我的代码:
import android.os.AsyncTask;
import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.Events;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* An asynchronous task that handles the Google Calendar API call.
* Placing the API calls in their own task ensures the UI stays responsive.
*/
/**
* Created by miguel on 5/29/15.
*/
public class ApiAsyncTask3 extends AsyncTask<Void, Void, Void> {
private MainActivity mActivity3;
/**
* Constructor.
* @param activity MainActivity that spawned this task.
*/
ApiAsyncTask3(MainActivity activity) {
this.mActivity3 = activity;
}
/**
* Background task to call Google Calendar API.
* @param params no parameters needed for this task.
*/
@Override
protected Void doInBackground(Void... params) {
try {
mActivity3.clearResultsText();
mActivity3.updateResultsText(getDataFromApi());
} catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
mActivity3.showGooglePlayServicesAvailabilityErrorDialog(
availabilityException.getConnectionStatusCode());
} catch (UserRecoverableAuthIOException userRecoverableException) {
mActivity3.startActivityForResult(
userRecoverableException.getIntent(),
BlockOrderGCalDaily.REQUEST_AUTHORIZATION);
}
慕的地8271018
肥皂起泡泡
相关分类