Replace file pre-loaded

Can I preload a file in my application. Deploy the application in a device and then dynamically, replace it once the application is running, i.e. to open the file and edit some content or files preloaded are read only?

If I can open it and replace some content, then how can specify the path of a file named as below:

private static String _xmlFileName = "/ content / content.xml ';

One way is like that. Suppose that you decide to use the store for the replaceable image. Startup of the application (or the image recovery whenever it is necessary) works as follows (details left as an exercise ):

Bitmap getImage(String imageID) {   byte[] imageData = readImageDataFromStore(imageID);
  if (imageData == null) {
    imageData = copyImageResourceToStore(imageID);
  }
  image = Bitmap.createBitmapFromPng(imageData, 0, -1);}

byte[] readImageDataFromStore(String id) {  // look for image data in persistent store  // return null if not found, else read fully and return as byte array}

void writeImageDataToStore(String id, byte[] data) {  //  write the given data to store where it can be retrieved by id}

String getResourceNameForID(String id) {  // look up the name of the resource file for the given id  // so, for instance, it might map "leftIconImg" to "images/bottom/ts_nav_center.png"} 

byte[] copyImageResourceToStore(String id) {  InputStream is = getClass().getResourceAsStream(getResourceNameForID(id));  ByteArrayOutputStream bos = new ByteArrayOutputStream();  byte[] buff = new byte[1000];  int len;   while ((len = is.read(buff)) > 0) {    bos.write(buff, 0, len);   }  is.close();  byte[] bytes = os.toByteArray();   writeImageDataToStore(String id, bytes);  return bytes; }  

When you decide to replace the image with something else, just replace the data in the persistent store. In this way, the image resource that comes with the application is never used as long as there is an image in the persistent store.

Tags: BlackBerry Developers

Similar Questions

  • HP Pavilion 15 laptop (15-p264: cannot install Windows 8.1 (W8.1 pre-loaded) regular updates)

    I bought a new laptop HP Pavilion 15 (product number: LOE38EA #ABU) a few months as a backup to my desktop PC.  It works fine except that it won't install the usual Windows 8.1 updates (Windows 8.1 has been pre-loaded).

    It downloads OK but when I restart it installation I get the message 'fail updated widows configuration', and he comes back the changes.

    I thought that it might be due to the fact that I loaded a few old Windows XP software (which will actually OK) and so I uninstalled everything, but that didn't solve the problem.

    The only other thing I've done is to replace the protection installed with Norton antivirus software that I use on my desktop.

    The list of the 'updates' that I can not install works now at 31.

    Any ideas?

    Thank you

    Hello

    Please try one or two on the list. If ok, split the list to a few lots, do not combine them into one time.

    Kind regards.

  • Is BlackBerry Smartphones there a way to transfer standard, pre-loaded, notifier sounds of my Curve 8900 to my lamp?

    Is it possible to transfer sounds standard, pre-loaded, notifying my old Curve 8900 to my new torch?  I am looking for Notifier_Greeter and Notifier_Lucid, in particular.

    I found the answer myself!  YES, there is, and it's the best way to do this that I've seen on any advice!  Download them all for free here: [link removed for administrative review] I saved the file to my PC for security reasons.  Then I sent the tones I want my BB, open the files, and they have installed on their own.  Wahoo!  I'm a happy camper!

  • Help to restore my pre loaded Windows 7 Home Basic

    I bought the SONY VAIO with windows 7 Home Basic pre loaded.

    The hard drive had to be replaced and the repairman charged ultima windows
    by mistake, instead of my real pre loaded windows Home Basic 7
    due to which I get 'NOT genuine software '.
    / Experts of the forum can help me please. Kindly give me detailed process since I am not an expert.
    Thanks in advance
    Ramesh Vasappanavara

    You will need create an all in one DVD and select Reinstall Windows 7 Home Basic Edition. The following article will show you how:

    For a DVD that contains all the flavors of 32-bit and a DVD that contains all the flavors of 64-bit Windows 7: Starter, Home Basic , Home Premium, Professional and Ultimate see here

  • Pre loaded software on laptop

    I have a new ProBook 5330 m which comes pre loaded with Excel Starter 2010. I loaded my own suite Microsoft Office 2007 which I would prefer to use. When you use default Office Excel Starter 2010 how can I change the default value to my Office 2007?

    Solved my problem, deleted pre loaded software and fixed all files that are opened with the wrong program.

    BH, I'm sure that you told me to do the same thing, thanks

  • Pavilion 14 G6S71UA #ABA: I'll always be able to use the pre-loaded software HP products if I do a clean install of Windows 10?

    I have a laptop 14 flag that came with Windows 8.1 - 64 Home, and I have upgraded to Windows Home 10-64. The upgrade went very wrong, but I would use Win 10 if possible. Microsoft recommends that I have to do a clean install of Windows 10, which will require you to reinstall all my programs MANY. They cannot tell me, however, if I'll still be able to use some of the applications delivered HP pre-loaded on my machine and that I find very useful - even if I am out of warranty. For example, I use HP Support Assistant updates the driver, and I found that HP DriveGuard works really well!

    I'll always be able to download all of these products and hence? I'll be able to get them on the page of the drivers for my laptop? If I can't, I'll probably have to settle for return to Windows 8.1.

    Thank you.

    Because the rep on the Microsoft forum did not answer my questions, today I called the support of Microsoft Windows 10 phone number. After that the rep is lost another hour of time my (and their) me browsing to enter SafeMode via several methods, everything I told him that I had already tried. the representative suggested that customizations of account that I had applied could be the cause of the distress.

    She also informed me that, for security reasons, Windows 10 no longer allows connectivity Mode Wireless safe; Although, if your PC is physically connected to the modem/router, you should be able to enter in IE (and maybe even in Edge) in Safe Mode.

    So I added a new local administrator account (that said, I log in with a password and not with one account Microsoft.), to be used only for safe mode and left all its parameters to the default values for Microsoft. And it worked! When connected to my router, I could get in Mode safe mode with internet connectivity via IE! Thanks to this rep, I finally have success.

  • File not loading completely

    I'm fetch of signals using nor-scope. I use 'Write to worksheet File.vi', but everytime I open the txt file with excel, there is error in saying that "file not load completely. I don't know how I can solve this problem. Thank you!

    Cory K wrote:

    Excel has a row 65536 and the limit of 256 columns.

    Which applies only to Excel 2003 and more. Excel 2007, for example, has a something like a 16 000 column limit and beyond 1 million rows.

  • When the sequence of process template client file is loaded for execution?

    As part of a custom process template I've created, I would like to make a few changes in the sequence of the client before file called by the process template. These changes will be then be restored after the loop finishes USE (I'm changing the sequential model).

    Another thread, I discovered that TestStand sequences cannot be edited structurally once they have been loaded for execution. My question is: what is client sequence template process ' for execution "?

    After some research, I discovered that the sequence of the client file is not locked to prevent changes to the sequence editor until the "Reminder of the main sequence" sequence step call runs in the model process entry point. At this stage, the sequence of the client file is loaded dynamically as the module at this stage.

    However, before this point, there are two places that the file of the client's sequence is used, and I want to assure you that they don't 'load the customer file for execution.  The Runstate.ProcessModelClient property is a reference to the object the client file SequenceFile and exist as soon as the entry point is called. In addition, the engine must know about the sequence of the client file to correctly call reminders of process model. Do any of these things make the movie of 'responsible for performance customer file?

    It boils down to this: can I do safely from the structural changes to my file of sequence of the client during the ProcessSetup and ProcessCleanup?

    According to the information I found in another post (see the comments of Eric_Crank on page 2), it is allowed. However, in this case customers were only make changes to the property Data of the RunState.ProcessModelClient. I want to assure you that I can use the TestStand API on the reference too.

    Also, just FYI, I got this works. I can add steps to the sequence MainSequence customer sequence file of the group stage of installation of the point of entry of the process model via the API TestStand. I ask here if make sure that it is a safe thing to do, and that there is nothing I plan not to.

    Thank you.

    Josh,

    If your sequence allows the option "optimize no concave calls this sequence", the first time the sequence run TestStand stores a copy of the execution of the sequence in a cache associated with running. As long as the sequence is in this cache you can not change, and TestStand considers that the sequence for 'run' file (see the SequenceFile.IsExecuting property). You cannot unload 'enforcement' sequence files (see SequenceFile.CanUnload). Sequences remain in the cache until it is closed. There is no way for you to remove the sequences of this cache, but you can prevent them to be added to the cache by turning off the option "optimize... ». Disabling this option should have no impact on the performance that you call the sequence only once.

    -Erik

  • HP Split X 2 updated for Windows 8 pre-loaded to win 8.1, now cannot run Add function to Windows 8.1

    Hello!

    I bought a HP Split X 2 13.3 "laptop in a show of computer a little more than 1 year.

    It comes with Windows 8 pre-loaded at that time here.

    Later, Microsoft offers a free upgrade for all 8 to 8.1 Win win and I did as well.

    Everything goes perfectly smooth, at least until recently, when I try to go control panel perform add functionality of Windows 8.1.

    He asked me product key!

    When I looked at the bottom of my laptop Split X 2, it doesn't have the Windows product key sticker. There is only 1 sticker hologen Windows 8! Therefore, I use a key finder application to detect the product key.

    I enter the product key when I run add a feature to 8.1 win again, but the windows prompted me key is not valid.

    Why?

    Insalled Win8.1 is the authentic version. I can perform regular updates of Windows without problem.

    Appreciate if any expert can help solve my problem.

    Thank you very much

    Nkboy

    Hello

    The add feature is to upgrade your current Windows 8/8.1 Core Windows 8/8.1 Pro Edition or Windows Media Center Edition 8/8.1.

    It requires you to purchase the particular product key with regard to the option to add features.

    Here are some links to help you understand:

    http://Windows.Microsoft.com/en-us/Windows-8/Add-features-frequently-asked-questions

    http://www.eightforums.com/tutorials/6673-add-features-Windows-8-a.html

    Concerning

    Visruth

  • Upgrade to Windows windows 8.1 8.1 Preview and lost all the software pre-loaded HP

    Hello, I lost all the pre-loaded software that came with my HP Envy m6-1231ea which includes beats audio, AMD CCC for my graphics switchable, software Cyberlink etc. Also, I can't do the thing that scans my finger so I can connect to my laptop without using my password, is there anyway you can help the user?

    Latest version of the software SimplePass (by fingerprint) is here:

    http://ftp.HP.com/pub/SoftPaq/sp63001-63500/sp63224.exe

  • Just installed windows 7 on a hpp6130y that I bought in August came with free Windows 7 upgrade after installation I lost microsoft works and other software that has been pre loaded on pc.

    Just installed windows 7 on a hpp6130y that I bought in August came with free Windows 7 upgrade after installation I lost microsoft works and other software that has been pre loaded on pc.

    How your post is related to Windows Update (compared to the Windows upgrade)?

    Contact HP support.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • I created a zip file and loaded a lot of things I wanted on now it's gone can anyone help me please

    Help me please I don't know where he might be, and I'm not part of computers

    Hello

    1. how exactly did you create zip file and load the file in it?

    2. where did you had stored it?

    Step 1: Check if the file is hidden.

    Step 2: Find the file using Windows search.

  • Clean boot let B1-710 acer operating system and applications pre-loaded on Tablet?

    Tablet Acer leave B1-710 boot operating system and applications pre-loaded on tablet. It erases only my information and apps that I put on the tablet.

    http://Acer--UK.custhelp.com/app/answers/detail/A_ID/29892/~/Acer-Iconia-B1-A71-and-B1-710-factory-d...

    a factory data reset will return the tablet to factory default with the last OS update; so plant apps only, all your data and applications will be deleted.

  • Music pre-loaded...?

    So I just picked up a brand new clip of 4 GB. Great little player; works like a charm with my Mac.

    However. After charging, add music and then installing the latest firmware, I find that the Clip contains a handful of songs by artists who are not in my collection. I can only conclude that they were initially on the player.

    Since there is no mention of music pre-loaded in the literature, I guess that's a Clip used, or possibly a refurb. It was sealed in plastic and seemed to be a device up, but I wouldn't rather than my new player is technically used, so I intend to return.

    This happened to someone else?

    The Clip contains 5 songs free; in fact all readers mp3 I met came with a few sample preloaded songs.

    I've listed the songs that came with my Clip (4 GB) in this thread: songs that came with the 2 gig clip.

  • Pre-loaded applications

    Is it possible to remove the pre-loaded applications (but not system applications) from the phone?  If so how can they be restored if necessary?  Is there a list of pre-loaded applications that can safely be deleted and then restored?

    For a list of the app without danger to remove check XDA however if they are not removed through the normal means, then they are considered system applications leaving two choices either root and uninstall them completely or use a program called Debloater to freeze making them invisible to the draw apps - for you restore can UN - gel or re - install from the store room or perform a system repair

Maybe you are looking for