0

Is diff in any way, shape, or form included in Android such that it can be called from an Android app? Or do I just have to use one of the java packages available (e.g. Generate formatted diff output in Java).

Basically what I'm trying to do is open an xml file, and then immediately output an xml file to ensure that my app isn't screwing anything up with its import/export process.

Community
  • 1
  • 1
Ross Aiken
  • 912
  • 1
  • 6
  • 16

2 Answers2

0

I wouldn't assume it was available, I'd use one of the java implementations. I doubt you can even reliably shell out or anything without jailbreaking.

Bill K
  • 62,186
  • 18
  • 105
  • 157
  • While not exactly what I was asking for (since what I was asking for likely doesn't exist), it is a viable workaround. Thanks. – Ross Aiken May 10 '12 at 02:02
0

I'd take a look at this post: Where are my Android app's data files?

You could try reading in the XML, then writing it out to a new file, then using adb to pull both files and do the diff on your computer (not on the device).

Community
  • 1
  • 1
theelfismike
  • 1,621
  • 12
  • 18
  • That would work for testing, but I want this to be something which is automated and happens whenever anyone runs the app (and if it detects differences, have it pop up a message which brings up the option of emailing me the failing file so that I can find and remedy the bugs. – Ross Aiken Apr 17 '12 at 22:08
  • If you don't care about a nice diff view, you could write the output file, then open both as inputStreams, and compare byte-by-byte to see if they're exactly the same. – theelfismike Apr 17 '12 at 22:50
  • 1
    or just take an md5 hash of the files and if they differ send the file back to HQ – Moog Aug 23 '12 at 11:28