0
votes

I am trying to develop a simple android application using the Sync API for dropbox. The user clicks a scan button which launches a QR Code scanner. The QR code that is read is the file name for a file on dropbox. Eg qr code reads 123456.txt

The txt files are a list of 14 items set out with one item per line eg. ITEM 1 ITEM 2 ITEM 3

The file is read into an ArrayList,I can download and read the file no problem, but the problem is changing the file on dropbox when the user clicks save. Each item is loaded into an EditText and when save is pressed it reads all of the edittexts and replaces the original file. I've tried a simple

testFile.writestring(array.getItem(0).toString();
testFile.writestring(array.getItem(1).toString();
etc

But I get one file being replaced x many times for each string. For example for those two lines I get one file with just 'ITEM 1' as the contents then a few seconds later it gets updated to just 'ITEM 2'

Any Ideas?

1

1 Answers

0
votes

If I understand correctly what you're trying to do, I think you want something like this:

testFile.writeString("\n", TextUtils.join(array));

(Apologies if the syntax isn't quite right. I've never done any Android development, and TextUtils.join is specific to that platform.)