Google が提供する App Engine 向けのチュートリアルは、プログラムを起動するために提供される非常に単純なコピー ペースト コードです。私は、コードを MainActivity.01 というファイルからプログラム内の MainActivity ファイルにコピーする部分にいました。その後、メソッドが未定義であるというエラーがありましたが、バックエンド プロジェクトで定義されていますが、クライアント プロジェクトで作成したライブラリでは定義されていません。誰かがチュートリアルに精通している場合、私はクライアントアプリケーションの変更のステップにいます。リンクはこちら
私に問題を与えているコードは
protected Void doInBackground(Void... params) {
CheckIn checkin = new CheckIn();
checkin.setPlaceId("StoreNo123");//problem**************************
Checkinendpoint.Builder builder = new Checkinendpoint.Builder(
AndroidHttp.newCompatibleTransport(), new JacksonFactory(),
null);
builder = CloudEndpointUtils.updateBuilder(builder);
Checkinendpoint endpoint = builder.build();
try {
endpoint.insertCheckIn(checkin).execute();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}`
バックエンド プロジェクトでメソッドが定義されているクラス
package com.google.samplesolutions.mobileassistant;
import java.util.Date;
import com.google.appengine.api.datastore.Key;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class CheckIn {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
private String placeId;
private String userEmail;
private Date checkinDate;
public Key getKey() {
return key;
}
public String getPlaceId() {
return placeId;
}
public void setPlaceId(String placeId) {
this.placeId = placeId;
}
public String getUserEmail() {
return userEmail;
}
public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}
public Date getCheckinDate() {
return checkinDate;
}
public void setCheckinDate(Date date) {
checkinDate = date;
}
}
クライアントプロジェクトの下のクラス
package com.google.samplesolutions.mobileassistant.checkinendpoint.model;
/**
* Model definition for CheckIn.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the checkinendpoint. For a detailed explanation see:
* <a href="http://code.google.com/p/google-http-java-client/wiki/JSON">http://code.google.com/p/google-http-java-client/wiki/JSON</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class CheckIn extends com.google.api.client.json.GenericJson {
@Override
public CheckIn set(String fieldName, Object value) {
return (CheckIn) super.set(fieldName, value);
}
@Override
public CheckIn clone() {
return (CheckIn) super.clone();
}
}