Retrieving and parsing iCal data over HTTP on Android

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.

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

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?

Asked by: Walter405 | Posted: 24-01-2022

Answer 1

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. Get the user's ID entered in the UI
    • String userId = ((EditText) findById(;
  2. Generate the user's unique calendar URL
    • static final String CALENDAR_BASE = "";
      String escapedUserId = URLEncoder.encode(userId, "UTF-8");
      String url = CALENDAR_BASE + escapedUserId +"/events.ics";
  3. Retrieve the calendar file over HTTP
  4. Save the file locally
  5. Display the calendar data to the user
    • Read the file from disk that you saved directly from the web
    • Parse the data with iCal4j and display in whatever UI format you like

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. :)

Answered by: Lucas590 | Posted: 25-02-2022

Similar questions

android - Retrieving and Parsing JSON

What's the easiest way to retrieve JSON from a web-service and to parse it? Without using any additional plug-ins?

android - Retrieving .json file from assets and Parsing

I'm trying to retrieve a .json file that i generated in my assets in order to test my ListView , I'm having trouble when running the app the try/catch is always returning exception and the file is never loaded,ListView returns "No data" , here's my code Please Note that this class extends FragmentList

Parsing JSON in Android not retrieving all JSON array

in Android while parsing JSON, it parse only 10 items of JSON array. for example it doesnot matter if i decrease the count to 5 it still return 10 items. but, when i browse the URL in browner. it return all 20 items ... Please help me out. public class MainListActivity extends Actio...

java - Retrieving String from class (xml parsing class) to current class

I wrote two classes, one is used to retrieve fields from an XML feed and store them as Strings in the class, and the other class is supposed to retrieve those fields to set the text various TextViews in a xml layout file. Using Logs, I managed to see that the xml parser class does get the fields from the xml feed since they are printed in the android monitor, but they are not printed in the other class when I try ...

android - Parsing and saving a nested JSON into SQLite, and then retrieving it

Edit I managed to insert only the outer JSON object. Couldn't find information on how to insert nested objects. Each object has primitive fields in it. These objects can be seen in the JSON sample below: "languages" and "currencies". I also wonder how to deal with the "latlng" array within the outer JSON object, but it's probably better to handle these issues one at a time. The code I got f...

android - Is there a way of retrieving a TextView's visible line count or range?

I have a full-screen TextView holding a long Spanned that requires scrolling. The TextView's getLineCount() gives me the total number of lines used for the entire block of text but I'd like to know how many lines of text are currently visible on the screen. Or, better yet, is there a way to figure out the range of lines currently visible on the screen? For example, as the view scrolls, can I tell that lines 20-...

android - retrieving information from web service calls

I am trying to retrieve information from a web service call. The following is what I have so far. In my text view, it is showing Map {item=anyType{key=TestKey; value=2;}; item=anyType{key=TestField; value=adsfasd; };} When I ran that in the debugger, I can see the information above in the variable, tempvar. But the question is, how do I retrieve the information (i.e. the actual values of "...

Android SQLite crashes after trying retrieving data from it

Hey everyone. I'm kinda new to android programming so please bear with me. I'm having some problems with retrieving records from the db. Basically, all I want to do is to store latitudes and longitudes which GPS positioning functions outputs and display them in a list using ListActivity on different tab later on. This is how the code for my DBAdapter helper class looks like: public class DBAdapter { pu...

android - Retrieving all Drawable resources from Resources object

In my Android project, I want to loop through the entire collection of Drawable resources. Normally, you can only retrieve a specific resource via its ID using something like: InputStream is = Resources.getSystem().openRawResource(resourceId) However, I want to get all Drawable resources where I won't know their ID's beforehand. Is there a colle...

java - Storing and retrieving url links

I have 300 url links that I want store, I plan to have 10 xml's, below is my code, how can I store the urls in a xml and retrieve them in this code?? I want to get the coordinates based on the users selection from a list view. public class official extends Activity { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack())...

java - Retrieving HTML encoded text from XML using SAXParser

This is my first time using SAXParser, (I'm using it in Android, but I don't think that makes a difference for this particular issue) and I'm trying to read in data from an RSS feed. So far, it's working great for me for the most part, but I'm having trouble when it gets to a tag that contains HTML encoded text (e.g. <a href="http://...). The characters() method only reads in the &amp...

java - Retrieving a single column of last row in sqlite/Android using ORDER ID desc limit 1

I'm attempting to create a method that will allow me to retrieve a value from the last row of a database, and then insert it into an EditText field. (This is a value that the user will not change all that often, so it would be helpful if when they do set it, it stays set when they come back to it). My method, based on a similar method I have for getting the total of a specific column, is as such: pu...

android - Retrieving SIM ID

After searching the API and no luck, mybe anyone know how could I retrieve the SIM ID of the device? thanks, ray.

Widget for retrieving the timeline of a user with Twitter4j, OAuth on Android

I see the sample codes and walkthroughs on how to register your application, get the pin/uid and retrieve the access token and use it in the OnNewIntent method. How can I do this OAuth authentication for a widget instead of an application?

java - Retrieving users registered gmail that he/she uses to login to market?

As topic says. I want to get the email a user has registered on their phone to log on into android market. This due to the fact that my application connects to a remote database that´s supposed to store who have done a specific thing in the app.. I´ve searched the web for similar problems, but i have´nt found a possible solution yet.. :/ Does anyone have a nice codesnippet that shows how to do this? ...

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android