• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

reading Shared_prefs file of another application using content provider

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
So Im trying to solve a problem and I was previously posting on this trying to code a certain solution but I think I went up the wrong path and Android wouldn't let me access the file.

In my Android application, I'm trying to read the value stored in the shared_prefs folder of another application. That application exports a content provider.

Anyone any idea what way to code this.

Thanks,
Paul
 
Pol Denais
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so far I can read the value of the shared file by using the content uri: content://com.application1/shared_prefs/application1_conf.xml. Manually this pulls back the details of the XML file. Now I need some help below on my code below to read the file and pick out one value only. I don't want all the values in the Xml, just one. I then need to return this to the calling function.

appreciate any help


 
Rancher
Posts: 508
15
Notepad Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post what the contents of the file after reading it (from the variable buffer).
 
Pol Denais
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasad,
Thats just at the stage where I am at now, wondering how to pick one value from the XML file. so this is where I need to improve:

BufferedReader reader1 = new BufferedReader(new InputStreamReader(content));
       String line1;
       StringBuffer buffer = new StringBuffer();
       try {
           while ((line1 = reader1.readLine()) != null) {
               //mTextResults.append(line1);
               buffer.append(line1);
           }
 
Did you miss me? Did you miss this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic