Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there something equivalent to plist files in Android like we have in iOS?

When programming iOS apps we can have data in a plist file then read it in/out in a matter of one-two lines with NSDictionary. Does something like this exists on Android? I have already made an app on iOS with a plist file containing a couple of hundred entries. That is just normal XML isn't it? So I can parse the file with SAX/DOM Java parser?

like image 642
LuckyLuke Avatar asked Sep 10 '11 15:09

LuckyLuke


People also ask

What is Android plist?

plist (Property List) is a flexible and convenient format for storing application data.

What are plist files on iPhone?

plist file contains critical information about the configuration of an iOS mobile app—such as iOS versions that are supported and device compatibility—which the operating system uses to interact with the app. This file is automatically created when the mobile app is compiled.


1 Answers

Plist files exist in one of three forms:

  • NeXTSTEP format (which looks a lot like JSON). This is deprecated.
  • XML format (which you can parse on any platform very easily)
  • Binary format (which is not documented by Apple but saves space compared to the XML format)

If the plist file you want to parse is in NeXTSTEP or XML format, it is easy to build a parser for it using existing tools on most platforms. In the case of the XML format, yes you can use Java's inbuilt parser.

If the plist file is binary, however, you will have to either roll your own parser or use an existing third-party class. One exists at http://www.java2s.com/Open-Source/Java-Document/Swing-Library/jide-oss-2.8.3/com/jidesoft/plaf/aqua/BinaryPListParser.java.htm, but I haven't used it myself so I can't vouch for its accuracy/quality/performance.

like image 97
Jonathan Grynspan Avatar answered Sep 28 '22 21:09

Jonathan Grynspan