PDA

View Full Version : Any android developers or java heads?



haribo
12th February, 2012, 10:36 AM
Looking a little help with someone in the know.
Im currently learning my way around the android SDK.
I have an idea for an app I want to make for my work, but have no idea if this API is capable of outputting data to .CVS format for import into a xmls spreadsheet?
anyone have an idea?
basically i have made simple screen with drop down, select the centre, enter you mileage and eventually it will get procesed to my expenses spreadsheet. anyone got some java experiance?

Bann32
22nd April, 2012, 10:15 PM
What you want to do shouldn't be that difficult. Its been years since I did java and I haven't compiled this code but basically its something like





public static void main(String args[]) {
System.out.println("Enter your Centre: ");
String centre = input.nextLine();
System.out.println("Enter your mileage : ");
String milage = input.nextline();

try
{
FileWriter writer = new FileWriter("C:\\test.csv");
writer.append(distance);
writer.append(",);
writer.append(milage);
writer.append("/r/n"): //end of line flag

writer.flush();
writer.close();
}
catch(IOException e)
{
}



But as you wanted a drop down menu you need to create a combobox



String[] centreStrings = { "aaa", "bbb", "ccc", "ddd", "eee" };
JComboBox centreList = new JComboBox(centreStrings);
//can't edit the options it must be in the list
centreList.setEditable(false);
centreList.setSelectedIndex(0); //to select top of list "aaa"


There is a bit missing an actionlistener on the combo box but these bits and bats should put you in right direction at least.

Why do you want to do it in java though? and if I am well off I am sure someone will put it right