0

I have an app written for Android 2.2 (API 8) that depends on some XML features that were introduced in that API version, for example TransformerFactory.

Now I need to make the app work on an Android 1.5 device. I was wondering if it's possible to get the source code or JAR file that contains this code and insert it into my app? I'm assuming it doesn't have any external dependencies on Android 2.2 features since it is just an XML library.

jfritz42
  • 5,913
  • 5
  • 50
  • 66

3 Answers3

0

Here is link for android source Android source. There is no guarantee that even though you copy paste the code will work and or if it's worth effort.

slayton
  • 20,123
  • 10
  • 60
  • 89
kosa
  • 65,990
  • 13
  • 130
  • 167
0

You can get the Android sources from: github

kosa
  • 65,990
  • 13
  • 130
  • 167
slayton
  • 20,123
  • 10
  • 60
  • 89
0

I discovered it is not really possible to extract the parts I needed from the Android source. There were dependencies on Dalvik internals.

However, I found another question that helped me solve my real need: some way to write a DOM tree to an XML file prior to Android 2.2: Writing XML on Android

The solution I took was to write a class that recurses over a DOM tree and writes the nodes using the org.xmlpull.v1.XmlSerializer class (which you can get an instance of via android.util.Xml.newSerializer())

Then I used a lazy-loading technique to make my application load my custom class if the Android SDK was less than API 8 (Android 2.2). Otherwise it would use a wrapper class for the standard Transformer class. See: How to have your cupcake and eat it too

Community
  • 1
  • 1
jfritz42
  • 5,913
  • 5
  • 50
  • 66