Android configuration setup application politics - java

I have made an android app and I have some .csv files with initial data. Can anyone suggest a proper way to do that? For example, someone could say "just create a folder and put them inside" but I want a better way like a setup that I can do with windows (e.g. installshield but no so advanced ).

You can make with wizard forms. In first window choose .csv file, in second window
match the fileds of .csv file with database fildes and finally upload data.

Related

Where and how to store text files for reading/writing

I have an app that accesses words from a csv text files. Since they usually do not change I have them placed inside a .jar file and read them using .getResourceAsStream call. I really like this approach since I do not have to place a bunch of files onto a user's computer - I just have one .jar file.
The problem is that I wanted to allow "admin" to add or delete the words within the application and then send the new version of the app to other users. This would happen very rarely (99.9% only read operations and 0.1% write). However, I found out that it is not possible to write to text files inside the .jar file. Is there any solution that would be appropriate for what I want and if so please explain it in detail as I'm still new to Java.
It is not possible because You can't change any content of a jar which is currently used by a JVM.
Better Choose alternate solution like keeping your jar file and text file within the same folder

How to create a dashboard using excel and .bat file

I would like to ask the community if there is any way to create a GUI menu where the options will populate itself based on number of files that are saved in a folder directory. The user will then have two options whereby he can choose to generate a status or a dashboard option. After he chooses the report that he wish to generate, another menu will appear to ask him which document he want to select. This is where the menu would check the folder and generate the options based on number of files in the folder. For example, there could be doc1 and doc2 in the folder. Then the menu will generate 2 options. 1. Select doc1. 2. Select doc2. Then after the user inserted another doc3 into the folder. The menu will add another 3. Select doc3 without having the user to change the code. Is there a way to do this? Thanks.
This makes no sense. A .bat file is by definition something that does not have a GUI.
Also you really have provided the vaguest information for something seemingly large, and there appears to be no reason why you've also tagged this as excel and exe.
Since your .bat file could launch a particular Excel file, you could go that way, putting all the dashboard info in the spreadsheet. Would require some VBA code to make it as interactive as it sounds like you want, but that's entirely possible.
I'm not aware of any way that a .bat file can create a GUI on its own, although I may be missing something. Since the .bat file can run almost anything, it can be a starting point, but the heavy lifting would be done in something else.
Another approach would be to look at AutoHotkey, which can give you a GUI and a fair bit of processing power & interactivity all within the one script. The URL is http://www.autohotkey.com/ and that site has a tremendous amount of examples and help available. Also some AHK questions here on Stack Overflow from time to time.
Either way you go, it's a fairly large project. Good luck!

Saves game level settings

I have been coding for about a month and I have found ways to adapt around ever problem but one. The problem as you can probably see by the title is how to make a way to make game saves. I am currently creating a very simple game that has about 5 classes of my code and maybe 2 of Java Swing GUI.
I know how I would like to go about the saving process but I have no idea how to do it in my code. How I would like to go about doing this is by making the code print a Number or Integer to a file to represent a Level. For example if you completed level 1 the number in the file would be 1. I have tried some templates for this but none of them work.
I understand how to write to a file but my problem is reading it from a jar or even creating a file then reading it from a place on the computer. I need to know how to find a file URL for different computers because some use Docs and Settings and other Users. Please could someone help.
Since the jar is read only, it can only contain the 'default settings'. See this answer for the general strategy to deal with such a embedded-resource.
Speaking of which (embedded resources) see the info. page for more details on how to access them.
Here is an example of storing and reading a Properties file from the 'current directory'.
As mentioned by #MadProgrammer though, it is safest to put the settings file into a (sub-directory) of user.home, as seen in this answer.
But a properties file is just one option. You might also serialize an object, or write the file in a custom format that your app. knows how to read, for the first two off the top of my head.
Besides 'serialize (in some form) in a File', there is also the Preferences API, or for desktop applications launched using Java Web Start, the PersistenceService. Here is a demo. of the service.
I need to know how to find a file url for different computers because
some use Docs and Settings and other Users
The System property user.home points to the user's home directory
File userHome = new File(System.getProperty("user.home"));

Is it possible to automate excel from a java applet running in full trust?

I'm looking at all possible languages to solve a particular business case problem.
Basically need a way to allow user to browse for an excel file locally, then using Microsoft Excel COM automation, read in the cell contents and from this point on perform some actions.
I have no experience with Java, but I know this type of thing is "almost" possible using Silverlight 4.0. Here is a line of code that demonstates how you begin automation in silverlight using c#:
dynamic objExcel = AutomationFactory.CreateObject("Excel.Application");
Problem is Silverlight only opens files from "My Documents", and it seems there is nothing you can do to allow the app full access to the file system to read in any file. So I'm investigating if Java is capable of this task?
I don't need a big explanation on how to do it, mainly I just need your experience as a Java developer to say - Yes in principle its certainly possible, or not. I need to open this xls file from any location the user specifies.
So 2 things really:
Can you browse and open any file using a trusted java applet? And get access to the files path from the open dialog?
Can you automate MS Word / Excel from a Java applet.
Thanks
..Silverlight only opens files from "My Documents", ..
Java will not be able to break that security restriction.
It is for the benefit of the end user, in that if they truly want to edit the Excel file, they will save or move it to My Documents. If they cannot do that, then perhaps they should not be altering the file.

Holding Information in Android App

I've only just started to write in Java on Android, so please bear with me.
I have some settings I want to hold in my app, normally I would have used an xml file. Trouble is i'm not sure how to load it into the xml parser to read it.
I thought I might be able to drop it into /res/values/Info.xml and open it from there but it does'nt find the file.
I have also read that people are starting to use a SQLite database to hold information in, is this more the standard way to go?
thanks a lot
Luke
It sounds like what you want are Shared Preferences. Its a simple way of storing key value pairs, along with a UI for letting the user change them.
You could try storing to External Files (that way they can save settings on an SD card if they have 2.2). You wouldn't be able to modify the files in the res folder like you tried because these files get compiled into the app package. You could also try Internal Files found on the same page. SQLite might be a bit much for config settings.

Categories

Resources