Bob Clegg
Bob Clegg

Reputation: 563

Android access to IO

Building an app that gets a list of widgets from an SQlite database then sends them down the wire to a DotNet Webservice.

Each widget may have a set of pictures in the file system that is associated by name. BlahWidget1.jpg, BlahWidget2.jpg being two photos for record blahWidget.

Need to box BlahWidget and its photos into an XML element for sending down the wire in a SOAP request.

I am thinking of a Picture Class that can hold the file name and produce a xml string representing the byte[] of the picture when asked.

Widget Class would have an ArrayList and would build a xml string of itself and its pictures when asked.

It seems however the only access to the file system is from a class that extends activity.

e.g. File filesDir = getFilesDir(); can't be used in my Picture class. Have I got it right or have I just not found the right library to import to handle this situation. Thanks

Upvotes: 0

Views: 54

Answers (1)

Henry
Henry

Reputation: 43728

You can pass the directory to your class for example when it is constructed:

MyPicture pic = new MyPicture(getFilesDir());

Upvotes: 1

Related Questions