Pol Denais

Greenhorn
+ Follow
since Apr 07, 2018
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pol Denais

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);
           }
5 years ago
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


5 years ago
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
5 years ago
Thanks Prasad, Yeah I think I'm looking at the wrong idea. Could be I need to look at content provider to read this value.
5 years ago
Thought I could try this instead below in an easier way but pin is showing null :


5 years ago
why is the mFile value


/data/user/0/com.application1/shared_prefs/app1_conf.xml



Should it not be :

/data/data/com.application1/shared_prefs/app1_conf.xml
5 years ago

Still no joy. It finds the package name now but still returns null

5 years ago
Ok I put in Log.i("mainActivity", "My key is " + key);


and when I debug I can see, key is "Couldn't find"
5 years ago
Ok so the code in Application 1 uses the following:





In my application I was using the following code:




Thanks in advance
5 years ago
Thanks Prasad, Im just trying to debug it as my code is showing no value returned and when I debug, I can see a path location for my own application, in that its looking for application1_conf.xml under my own app's folder:

/data/user/0/com.nasher/shared_prefs/application1_conf.xml

I thought it should be looking for:

/data/user/0/com.application1/shared_prefs/application1_conf.xml
5 years ago
Thanks Prasad,

When application 2 is reading from Application 1's shared pref file (XML), how does it know what location to look ? Application 1s shared pref files sits under its folder on the device.


5 years ago
HI All,
My Android app needs to read a value from an XML file stored in shared_prefs under another app and store it in a parameter in my apps code. So I have the path to the file but I don't know how to code it:

the XML file is like:

5 years ago
Hi Stephan,
Thanks I went back through it all and I have it sorted now looking at bits of code online.

Thanks alot for you help on this and giving me pointers.

Greatly appreciated.

Pol
5 years ago

Pol Denais wrote:OK changed this code around: SORRY STILL NOT WORKING: doing something really stupid here now.


5 years ago
OK changed this code around:


5 years ago