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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:59:22+00:00 2026-06-04T07:59:22+00:00

I would like to push a text document from the apk into the /system

  • 0

I would like to push a text document from the apk into the /system directory (Yes its a app for rooted users) and was wondering how i would do this 🙂 My txt file is in the assests folder but it could be used if needed

  • 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-04T07:59:23+00:00Added an answer on June 4, 2026 at 7:59 am

    Place the text file in your project’s assets directory and then extract it to the filesystem with code like the one in the following thread:
    How to copy files from 'assets' folder to sdcard?

    EDIT: Here is some code that I use. For sourceFileName, pass in the name of the assets file relative to the assets folder (e.g. if you have myFile.txt in the assets folder, pass myFile.txt). For the destination file, pass a full path (e.g. /data/data/com.mycompany/mypackage/myFile.txt). context is the current activity (e.g. MyActivity.this).

    private boolean copyFile(Context context, String sourceFileName, String destFileName)
    {
        AssetManager assetManager = context.getAssets();
    
        File destFile = new File(destFileName);
    
        File destParentDir = destFile.getParentFile();
        destParentDir.mkdir();
    
        InputStream in = null;
        OutputStream out = null;
        try
        {
            in = assetManager.open(sourceFileName);
            out = new FileOutputStream(destFile);
    
            byte[] buffer = new byte[1024];
            int read;
            while ((read = in.read(buffer)) != -1)
            {
                out.write(buffer, 0, read);
            }
            in.close();
            in = null;
            out.flush();
            out.close();
            out = null;
    
            return true;
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    
        return false;
    }
    

    EDIT2: Turns out that the /system partition is mounted as read-only, even on rooted devices. This may help: Android: how to mount filesystem in RW from within my APK? (rooted, of course)

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

Sidebar

Related Questions

I would like to take the memory generated from my struct and push it
Is this possible? I would like to be able to push a text field's
We are developing a Customer feedback application and I would like to push the
I would like to parse the values from aspx pages, both what is passed
I would like to be able to operate a scanner from my AIR application.
I would like to add resource files to a .bundle and push them to
I'm been reading up on Ajax and would like to see from the stackoverflow
I have two elements (a field and some text) that I would like to
Objective: I would like to take a JSON String and pass it into JavaScript
I need to push some JSON data to my website which I would like

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.