Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8193969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:39:39+00:00 2026-06-07T04:39:39+00:00

I am trying to parse an icalendar file (.ics) using ical4j library, and its

  • 0

I am trying to parse an icalendar file (.ics) using ical4j library, and its working fine with all versions of Android but IceCreamSandwich and JellyBean.

Can someone tell me why its throwing FileNotFound Error only in ICS and JB but not in other versions of android?

Here’s my code :

public class MainActivity extends Activity {
String foo = null;
TextView TextView = null;

String fileName = "ical.ics";
String URL = "https://www.google.com/calendar/ical/m0es4hhj4g9d69ibak88tvoup0%40group.calendar.google.com/public/basic.ics";
StringBuilder b = new StringBuilder();

@Override
public void onCreate(Bundle savedInstanceState) {

    if (android.os.Build.VERSION.SDK_INT > 9) {
          StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
          StrictMode.setThreadPolicy(policy);
        }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TextView = (TextView)findViewById(R.id.Hello_World);

    new Download().execute();




  }


 final class Download extends AsyncTask<Void, Void, Void> {

        @Override
        protected void onPreExecute(){

            TextView.setText("Downloading");

        }

        @Override
        protected Void doInBackground(Void... arg0) {


             try {
                    URL url = new URL(URL);
                    HttpURLConnection c = (HttpURLConnection) url.openConnection();
                    c.setRequestMethod("GET");
                    c.setDoOutput(true);
                    c.connect();






                    FileOutputStream fos = openFileOutput(fileName, MainActivity.MODE_PRIVATE);

                    InputStream is = c.getInputStream();


                    byte[] buffer = new byte[1024];
                    int length = 0;
                    while ((length = is.read(buffer)) != -1) {
                        fos.write(buffer, 0, length);
                    }
                    fos.close();
                    is.close();
                } catch (IOException e) {
                    Log.d("log_tag", "Error: " + e);
                }


            return null;
        }


        @Override
        protected void onPostExecute(Void Result) {


            TextView.setText("Saved...Loading Data");
             new Loadicaldata().execute();

        }


    }



final class Loadicaldata extends AsyncTask<Void, Void, Void> {



    @Override
    protected Void doInBackground(Void... arg0) {


        FileInputStream fis = null;
        try {
            fis =  openFileInput(fileName);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }



        CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true);
        CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION, true);
        CalendarBuilder builder = new CalendarBuilder();



        try {
            Calendar calendar = builder.build(fis);
            b.append(calendar.getProperty("X-WR-CALNAME").getValue());
            for (Object event : calendar.getComponents(Component.VEVENT)) {
                if (((VEvent) event).getSummary() != null) {
                    b.append("\n\n");
                    b.append(((VEvent) event).getSummary().getValue());
                    b.append(": ");
                    b.append(((VEvent) event).getStartDate().getDate());

                }
            }


        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ParserException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }



        return null;
    }

    @Override
    protected void onPostExecute(Void Result) {


        TextView.setText(b.toString());

    }

}

Also, I have noticed that if I use Calendar.load(URL url) it works fine. So it is the saving and loading of file that is going wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:39:42+00:00Added an answer on June 7, 2026 at 4:39 am

    Try removing

    c.setDoOutput(true);
    

    (as suggested by this blog post)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a class that can parse an iCalendar file and
Whilst trying to parse MS Excel file using POI-HSSF v3.2 I am getting IndexOutOfBoundsException.
I'm trying parse the follow XML file: <root>Root <pai>Pai_1 <filho>Pai1,Filho1</filho> <filho>Pai1,Filho2</filho> </pai> <pai>Pai_2 <filho>Pai2,Filho1</filho>
Trying to parse some XML but apparently this is too much for a lazy
Im trying to parse the string located in /proc/stat in a linux filesystem using
I'm trying to parse a CSV file in C#. Split on commas (,). I
I am trying to parse specific XML file which is located in sub directories
Trying to parse a YouTube feed using PHP simplexml_load_file(); I am able to access
I'm trying to parse a MIME-Message, using SharpMimeTools and some sample Mime Messages from
I'm trying to send an iCal to an outlook, using Java Mail Library, I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.