如何在android emulator上使用google电子表格api

如何在android emulator上使用google电子表格api,android,google-data-api,Android,Google Data Api,我正在尝试使用谷歌电子表格api来更新工作表的单元格。 我按照指南的要求,试图发送一个HttpPut请求,但失败了 我从下面的代码中得到了200个OK,但是工作表中没有任何内容可以更新…….T.T String cellUri = "https://spreadsheets.google.com/feeds/cells/tD0jOr1kFs6yHag573hB0YA/od6/private/full/R2C2"; HttpPut httpput = new HttpPut(cellU

我正在尝试使用谷歌电子表格api来更新工作表的单元格。 我按照指南的要求,试图发送一个HttpPut请求,但失败了

我从下面的代码中得到了200个OK,但是工作表中没有任何内容可以更新…….T.T

String cellUri = "https://spreadsheets.google.com/feeds/cells/tD0jOr1kFs6yHag573hB0YA/od6/private/full/R2C2";

     HttpPut httpput = new HttpPut(cellUri);

     httpput.addHeader( new BasicHeader("Content-Type", "application/atom+xml"));
     httpput.addHeader( new BasicHeader("GData-Version", "3.0"));
     httpput.addHeader( new BasicHeader("If-Match", "*"));

     String reqBody="<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:gs=\"http://schemas.google.com/spreadsheets/2006\">" +
       "<id>https://spreadsheets.google.com/feeds/cells/tD0jOr1kFs6yHag573hB0YA/od6/private/full/R2C2</id>" +
       "<link rel=\"edit\" type=\"application/atom+xml\" href=\"https://spreadsheets.google.com/feeds/cells/tD0jOr1kFs6yHag573hB0YA/od6/private/full/R2C2/a115r\"/>" +
       "<gs:cell row=\"2\" col=\"2\" inputValue='99999'/>" +
       "</entry>";

     try
     {
      httpput.setEntity( new StringEntity(reqBody));
   HttpResponse updateCellResponse = new DefaultHttpClient().execute(httpput);
   if( updateCellResponse.getStatusLine().getStatusCode() != 200)
    Log.i("html2", "sl : " + updateCellResponse.getStatusLine());

   //display toast notification
   Toast _toast = Toast.makeText(getApplicationContext(), updateCellResponse.getStatusLine().toString() , Toast.LENGTH_SHORT);
   _toast.show();
     }
     catch(ClientProtocolException e )
     {
      Log.i("html2", e.getMessage().toString());
     }
     catch(IOException e )
     {
      Log.i("html2", e.getMessage().toString());
     }

    }
String cellUri=”https://spreadsheets.google.com/feeds/cells/tD0jOr1kFs6yHag573hB0YA/od6/private/full/R2C2";
HttpPut HttpPut=新的HttpPut(cellUri);
addHeader(新的BasicHeader(“内容类型”、“应用程序/atom+xml”);
addHeader(新的BasicHeader(“GData版本”,“3.0”);
httpput.addHeader(新的BasicHeader(“如果匹配)”,“*”);
字符串reqBody=“”+
"https://spreadsheets.google.com/feeds/cells/tD0jOr1kFs6yHag573hB0YA/od6/private/full/R2C2" +
"" +
"" +
"";
尝试
{
httpput.setEntity(新StringEntity(reqBody));
HttpResponse updateCellResponse=new DefaultHttpClient().execute(httpput);
如果(updateCellResponse.getStatusLine().getStatusCode()!=200)
Log.i(“html2”,“sl:+updateCellResponse.getStatusLine());
//显示toast通知
Toast _Toast=Toast.makeText(getApplicationContext(),updateCellResponse.getStatusLine().toString(),Toast.LENGTH\u SHORT);
_toast.show();
}
捕获(客户端协议例外e)
{
i(“html2”,例如getMessage().toString());
}
捕获(IOE异常)
{
i(“html2”,例如getMessage().toString());
}
}