Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中从电子表格中检索数据?_Android - Fatal编程技术网

如何在android中从电子表格中检索数据?

如何在android中从电子表格中检索数据?,android,Android,我希望数据从电子表格到我的应用程序,以便我可以使用我的应用程序中的数据。我希望电子表格中的数据有两列,我可以使用电子表格中的数据。就像在java中一样。使用或JExcelApi。JExcelAPI更易于使用,但POI在内存方面更容易使用。杰克塞尔把一切都记在了记忆里。POI得到了更好的维护。您可以使用James Moore的代码: 使用上面的链接并仔细阅读,它会给你所有的答案。你能给我推荐一套我必须添加的jar文件吗https://developers.google.com/google-app

我希望数据从电子表格到我的应用程序,以便我可以使用我的应用程序中的数据。我希望电子表格中的数据有两列,我可以使用电子表格中的数据。

就像在java中一样。使用或JExcelApi。JExcelAPI更易于使用,但POI在内存方面更容易使用。杰克塞尔把一切都记在了记忆里。POI得到了更好的维护。

您可以使用James Moore的代码:


使用上面的链接并仔细阅读,它会给你所有的答案。你能给我推荐一套我必须添加的jar文件吗https://developers.google.com/google-apps/spreadsheets/?csw=can 你给我的样本项目,我可以作为参考尝试这个http://stackoverflow.com/questions/12478582/how-to-connect-android-app-with-google-spreadsheetSamples 在书页上和
package com.banshee;

import java.io.IOException;
import java.net.URL;

import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.data.spreadsheet.CustomElementCollection;
import com.google.gdata.data.spreadsheet.ListEntry;
import com.google.gdata.data.spreadsheet.ListFeed;
import com.google.gdata.util.ServiceException;

public class SpreadsheetSucker {
  public static void main(String[] args) {
    SpreadsheetService service = new SpreadsheetService("com.banshee");
    try {
      // Notice that the url ends
      // with default/public/values.
      // That wasn't obvious (at least to me)
      // from the documentation.
      String urlString = "https://spreadsheets.google.com/feeds/list/0AsaDhyyXNaFSdDJ2VUxtVGVWN1Yza1loU1RPVVU3OFE/default/public/values";

      // turn the string into a URL
      URL url = new URL(urlString);

      // You could substitute a cell feed here in place of
      // the list feed
      ListFeed feed = service.getFeed(url, ListFeed.class);

      for (ListEntry entry : feed.getEntries()) {
        CustomElementCollection elements = entry.getCustomElements();
        String name = elements.getValue("name");
        System.out.println(name);
        String number = elements.getValue("Number");
        System.out.println(number);
      }
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ServiceException e) {
      e.printStackTrace();
    }

  }
}