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

  • Home
  • SEARCH
  • 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 7440163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:48:35+00:00 2026-05-29T10:48:35+00:00

I have a problem with my android-app. I want to save a Data-list in

  • 0

I have a problem with my android-app.
I want to save a Data-list in a xml and save it to SD-Card.

Here the code fragment from my activity:

  Button btnActivity = (Button)findViewById(R.id.modul_save);
        btnActivity.setOnClickListener(new View.OnClickListener() 
        {   
            @Override
            public void onClick(View v) {
                Handlerlist templist=new Handlerlist();                                 //default-constructor for  handlerlist
                Parser_Writer temp_parser=new Parser_Writer();                          //default-constructor for praser(writing)
                templist.add_modul(name, abk, 1, 0, "Hallo", room, 1, 2, 3, 1.3, true); //save input-data in the list

                temp_parser.write_xml(templist);                                        //calls the parser(writing)
                Intent in = new Intent(modul_create.this,modul_overview.class);     
                startActivity(in);
            }
        });

This is my parser:

public class Parser_Writer {

public Parser_Writer(){
}

    public void write_xml(Handlerlist h){
        XStream xstream = new XStream(new DomDriver());
        try {
            String xml = xstream.toXML(h);

            String path=Environment.getExternalStorageDirectory().toString();

            File myXml= new File(path+"new.xml");
            myXml.createNewFile();
            FileWriter fileIO =new FileWriter(myXml);
            fileIO.write("<?xml version='1.0' encoding='utf-8'?>");
            fileIO.write(xml.toString());
            fileIO.close();

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

}

I also add the android.permission.WRITE_EXTERNAL_STORAGE… but i can not write on my storage!! I got the following logcat-message:

java.io.IOException: Read-only file system
at java.io.File.createNewFileImpl(Native Method)
at java.io.File.createNewFile(File.java:1160)
at Parser.Parser_Writer.write_xml(Parser_Writer.java:38)
at StundentenApp.main.modul_create$1.onClick(modul_create.java:51)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)

Someone here who could help me?

Thanks!

  • 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-05-29T10:48:37+00:00Added an answer on May 29, 2026 at 10:48 am

    This is a shot in the dark — it might be that you have your SD card locked after all — but try changing the following:

    File myXml= new File(path+"new.xml");
    

    to this:

    File myXml= new File(path+"/new.xml");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a android app that is quite simple it fetches data from the
I have a little/big problem in my app in android.I have 2 activity:Activity1 and
I have problem in uploading .doc file to .Net WCF from my Android app.
I have an interesting problem being reported to me from an android application I
I have developed an Android app which I want to be available both as
I'm abit new to programming Android App's, however I have come across a problem,
In my Android app, I have some data that needs to be synced daily
I am creating an android app which pulls in RSS Feeds from here http://spaceflight1.nasa.gov/realdata/sightings/cities/rss/index.cgi?country=United_Kingdom&region=England&city=Manchester
i have problem with my android app, i searched but cannot find answer, i
I have a current Android app that uses i18n via resources. res/values-es/strings.xml and so

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.