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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:16:24+00:00 2026-05-27T00:16:24+00:00

I want to write some bytes to a shared memory. This is done in

  • 0

I want to write some bytes to a shared memory. This is done in my application1. From my another application: application2 I want to access that shared memory to read the written bytes. For this purpose I tried using android’s MemoryFile class. I am stuck as how to refer to the same shard memory between two different application. I am also now confused if memoryFile is used for the same purpose or not.
http://developer.android.com/reference/android/os/MemoryFile.html this link I found regarding the topic.
Thanks in advance.
Krishna

  • 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-27T00:16:24+00:00Added an answer on May 27, 2026 at 12:16 am

    If you want some cross-process use with MemoryFile you can use the following fugly method:

    import android.os.MemoryFile;
    import android.os.ParcelFileDescriptor;
    
    import java.io.FileDescriptor;
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    
    public class MemoryFileUtil {
        private static final Method sMethodGetParcelFileDescriptor;
        private static final Method sMethodGetFileDescriptor;
        static {
            sMethodGetParcelFileDescriptor = get("getParcelFileDescriptor");
            sMethodGetFileDescriptor = get("getFileDescriptor");
        }
    
        public static ParcelFileDescriptor getParcelFileDescriptor(MemoryFile file) {
            try {
                return (ParcelFileDescriptor) sMethodGetParcelFileDescriptor.invoke(file);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            } catch (InvocationTargetException e) {
                throw new RuntimeException(e);
            }
        }
    
        public static FileDescriptor getFileDescriptor(MemoryFile file) {
            try {
                return (FileDescriptor) sMethodGetFileDescriptor.invoke(file);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            } catch (InvocationTargetException e) {
                throw new RuntimeException(e);
            }
        }
    
        private static Method get(String name) {
            try {
                return MemoryFile.class.getDeclaredMethod(name);
            } catch (NoSuchMethodException e) {
                throw new RuntimeException(e);
            }
        }
    }
    

    What you should be looking at is the #getParcelFileDescriptor(MemoryFile) method which you can return from an implementation of ContentProvider#openFile(Uri, String).

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

Sidebar

Related Questions

I want to write a routine that receives some jpeg frames from a server
I want to write some JavaScript that will change the onmousedown of a div
I want to write a word addin that does some computations and updates some
I want to write a ViewModel that always knows the current state of some
I have some xml encoded as UTF-8 and I want to write this to
I want write a repeating pattern of bytes into a block of memory. My
I want to write a simple istream object, that would simply transform another istream
I want to write some javascript and have it call into the DOM for
I want to write some debugging output to the log to review it with
I want to write some games, but I don't have any game development experience.

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.