检索和分析数据的iCal通过HTTP在Android [英] Retrieving and parsing iCal data over HTTP on Android

查看:161
本文介绍了检索和分析数据的iCal通过HTTP在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出,要求用户输入用户ID的应用程序,附加的用户ID为静态的HTTP链接,检索具有的.iCal(日历)扩展了用户的日常调度信息的文件。

I am making an application that asks the user for userid, appends the userid to a static HTTP link to retrieve the user's daily schedule info file that has a .ical (calendar) extension.

我需要阅读的文件,格式新的用户界面,并重新presenting在Android设备上一些有用的数据的数据。

I need to read the data from file, format in new UI and representing some useful data on an Android device.

我的查询是我可以访问幕后静态HTTP链接?当我使用桌面浏览器相同的链接,它会要求用户将文件保存—我怎样才能做到这一点在移动?我需要读取数据,并保存到某个地方或者我可以保存的.iCal文件,并从中读取?

My query is can I access a static HTTP link behind the scenes? And when I use the same link on desktop browser, it asks user to save the file — how can I do this on a mobile? Do I need to read the data and save it somewhere or I can save the .ical file and read from it?

推荐答案

Android设备一般不能处理的iCalendar格式的文件(的.ics)—没有办法只是开这样的文件和具有显示的信息。你将不得不写一些code(或使用一个库如 iCal4j )来解析信息日历文件。

Android devices generally cannot handle iCalendar-formatted files (.ics) — there is no way to just "open" such a file and have the information displayed. You would have to write some code (or use a library such as iCal4j) to parse the information in the calendar file.

根据你的问题和意见,你需要打破这种成几个部分:

Based on your question and comments, you need to break this into a few parts:

  1. 获取用户的ID在用户界面中输入
    • 字符串userid =((EditText上)findById(R.id.user_id))getText.toString();
  1. Get the user's ID entered in the UI
    • String userId = ((EditText) findById(R.id.user_id)).getText.toString();
  • 静态最后弦乐CALENDAR_BASE =htt​​p://example.com/cal/;
    字符串escapedUserId = URLEn coder.en code(用户ID,UTF-8);
    字符串URL = CALENDAR_BASE + escapedUserId +/ events.ics;
  • static final String CALENDAR_BASE = "http://example.com/cal/";
    String escapedUserId = URLEncoder.encode(userId, "UTF-8");
    String url = CALENDAR_BASE + escapedUserId +"/events.ics";
  • <一个href="http://stackoverflow.com/questions/576513/android-download-binary-file-problems">http://stackoverflow.com/questions/576513/android-download-binary-file-problems
    (感谢Pentium10)
  • http://stackoverflow.com/questions/576513/android-download-binary-file-problems
    (thanks to Pentium10)
  • 从磁盘读取您直接从网页
  • 保存的文件
  • 解析与iCal4j数据和任何用户界面的格式,你想显示

您可以搜索堆栈溢出或张贴任何有关的各个部分,如果你不能确定或需要一些更具体的信息进行更具体的问题。 :)

You can search Stack Overflow or post a more particular question regarding any of the individual parts if you're unsure or need some more specific info. :)

这篇关于检索和分析数据的iCal通过HTTP在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆