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 7068485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:19:47+00:00 2026-05-28T05:19:47+00:00

I am trying to develop a feature into my app to backup sms and

  • 0

I am trying to develop a feature into my app to backup sms and contacts to SD Card as .xml or .csv format and restore it later.

so please anyone give me some suggestions or some sample code or any resource links related to this.

thanks in advance

  • 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-28T05:19:47+00:00Added an answer on May 28, 2026 at 5:19 am
        public ArrayList<String> smsBuffer = new ArrayList<String>();
        String smsFile = "SMS"+".csv";
           private void  backupSMS(){
        smsBuffer.clear();
        Uri mSmsinboxQueryUri = Uri.parse("content://sms");
        Cursor cursor1 = getContentResolver().query(
                mSmsinboxQueryUri,
                new String[] { "_id", "thread_id", "address", "person", "date",
                        "body", "type" }, null, null, null);
        //startManagingCursor(cursor1);
        String[] columns = new String[] { "_id", "thread_id", "address", "person", "date", "body",
                "type" };
        if (cursor1.getCount() > 0) {
            String count = Integer.toString(cursor1.getCount());
            Log.d("Count",count);
            while (cursor1.moveToNext()) {
    
                 String messageId = cursor1.getString(cursor1
                        .getColumnIndex(columns[0]));
    
                 String threadId = cursor1.getString(cursor1
                        .getColumnIndex(columns[1]));
    
                String address = cursor1.getString(cursor1
                        .getColumnIndex(columns[2]));
                String name = cursor1.getString(cursor1
                        .getColumnIndex(columns[3]));
                String date = cursor1.getString(cursor1
                        .getColumnIndex(columns[4]));
                String msg = cursor1.getString(cursor1
                        .getColumnIndex(columns[5]));
                String type = cursor1.getString(cursor1
                        .getColumnIndex(columns[6]));
    
    
    
                smsBuffer.add(messageId + ","+ threadId+ ","+ address + "," + name + "," + date + " ," + msg + " ,"
                        + type);
    
            }           
            generateCSVFileForSMS(smsBuffer);
        }               
    }
    
    
     private void generateCSVFileForSMS(ArrayList<String> list)
    {
    
        try 
        {
            String storage_path = Environment.getExternalStorageDirectory().toString() + File.separator + smsFile;
            FileWriter write = new FileWriter(storage_path);
    
            write.append("messageId, threadId, Address, Name, Date, msg, type");
            write.append('\n');
    
            for (String s : list)
            {
                write.append(s);
                write.append('\n');
            }
            write.flush();
            write.close();
        }
    
        catch (NullPointerException e) 
        {
            System.out.println("Nullpointer Exception "+e);
             //  e.printStackTrace();
         }
        catch (IOException e) 
        {
            e.printStackTrace();
        }
        catch (Exception e) 
        {
            e.printStackTrace();
       }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to develop my first ASP.NET MVC web app and have run into
I'm trying to develop an app for ipad and I'm using the contenteditable feature.
I am trying to develop an XML export feature to give my application users
I am trying to develop a collapsable/accordion like feature in my iOS app. This
I'm trying to develop a firefox extension that inserts additional HTTP header fields into
I am trying develop an Android app which uses Google maps. So for the
We are trying to develop a timeout feature in application where we want alert
Well I am trying to develop a memo or notebook app with a new
I am trying to develop an add-ins for MapPoint (with forms, and other feature)
I'm trying to develop a Hybrid android app where all by logic to get

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.