Hello everyone,
I'm new to Android development. I've written my first little "get my feet wet" ap and am looking to expand on it. One thing I would like to do it give the user more options of things they can configure and I'm wondering about the best way to store that information.
At what point does it become worthwhile to start using mySQL vs just using string data in the prefrences? Or is there another option I've missed (maybe an xml file, but I'm not sure where that would be stored?).
In my case, I'm thinking I have fewer than 100 instances of an object (or objects) that would have 3 or 4 properties associated with them.
Thanks!
Use the SharedPreferences class, is the easiest way to achieve your goal (BTW, SharedPreferences generate a xml file to storing your preferences).
SharedPrefrences is what I used for my basic version, but my understanding is that it allows for name-value pairs right? That works well when you have a predetermined set of prefrences, but what if it's more fluid?
Say I want to allow the user to configure his widgits, and each widget has a number of properties - say "color", "number", and "size". Maybe one user will configure 3 widgets and another user might configure 25.
I can think of a couple of different ways to parse this out into name-value pairs, but is that the best way?
Yep... for me that is the best way. For each user you can put the values using someting like this:
UserName+WidgetID+"PreferenceName"
And thats all... the preferences will be unique for each case, without parsing and 0 errors
Ok, cool. That's one of the options I had considered but didn't know if that would be the most efficient. Of course I'd also have to have a list of all the "Widget ID's" stored in a preference to loop through as well.
I assume the maximum amount of data that can be stored in one prefrence is just whatever the Java max string length is...is that correct?
Yes, you're right
Related
I was thinking last night: wouldn't be it be awesome if we could customize the browser's user agent so that a certain page would load a specific user agent? There are often pages that I want loaded in desktop mode, and it's a little annoying to constantly have to go back and forth to change it.
I figure the best way would be to have a user-defined database containing domain names and their preferred user agent. The browser would run a quick cross-reference between the input domain and the database to see if it's listed. If it is listed, change the user agent to the defined one. If not, use the currently defined user agent.
I REALLY want to be a part of this mod. I have no Java experience whatsoever but I'm a quick learner and want to try it out. Can someone point me in the right direction? Where can I find the source for the browser/good resources for Java?
Thanks!
No one?
I had this idea a while back and think it would be fairly easy, albeit tedious, to accomplish.
in cyanogenmod, the browser code is at: packages/apps/Browser/src/com/android/browser
you'd have to
build the UI to customize the UA for a given domain & set the prefs in the db
check the URI against the prefs prior to initiating the download
if match is found, use per-site setting; else use general setting
alapapa said:
I had this idea a while back and think it would be fairly easy, albeit tedious, to accomplish.
in cyanogenmod, the browser code is at: packages/apps/Browser/src/com/android/browser
you'd have to
build the UI to customize the UA for a given domain & set the prefs in the db
check the URI against the prefs prior to initiating the download
if match is found, use per-site setting; else use general setting
Click to expand...
Click to collapse
Finally! Thanks for the reply. I'll look it over when I get home.
rickytenzer said:
Finally! Thanks for the reply. I'll look it over when I get home.
Click to expand...
Click to collapse
This is a good place to start: http://github.com/CyanogenMod/android
Started looking around at the code. Looking at BrowserSettings.java and I see where the UA gets selected. The goal is to now figure out where userAgent gets set.
Hey,
id like to enter my work schedule into my calendar. There is a limited number of different worktime events i would like to create a preset for. They would consist of the describtion, start/endtime and a category.
At the moment the easiest way is to look in the past month a copy the event i need for the next, then open it and edit the date.
But i would like that more simplified. Like seeing the whole month on screen, beeing able to hold press a day and then i could see a menu with my presets, so i could simply select my schedule for this day from the presets and be done with it. This would really speed up the process.
Is there a program that can do that?
Hi guys, I’m new to the forum and fairly new to Android devices in general. I’ve googled a good bit before posting, and searched this forum for some keywords, but haven’t come up with a solution to what I need to do.
I have what seems like a fairly simple need: Set up an android device the way I want it, and then clone this image to multiple other devices.
I work with an organization that conducts a lot of epidemiology surveillance in foreign countries. The surveys are done on android based devices with a collection of off-the-shelf apps, plus one we had custom built for our purpose. Data is sent to us via whatever mobile networks happen to be available in the country being surveyed (we buy our phones unlocked, and get the SIM cards in-country).
As we continue to expand, installing all those apps and getting all of the settings just right becomes a very tedious, repetitive task, when you consider doing 100+ phones a month. .
Ideally I would like to stick with the factory rom, just add/remove some apps and configure settings. The cloning process needs to be fairly straight-forward, and not require a bunch of apps to be installed on the target phones first, because that kind of defeats the purpose.
For the time being, we’re using Motorola Atrix and Atrix 2. We also have some XT720s but we’re phasing those out.
Not sure if this is relevant, but below is roughly what provisioning currently looks like:
1. We receive a batch of phones, say 100 at a time
2. First, do a factory reset, and go through the initial setup
3. Remove as many of the factory installed apps as possible
4. Set up WiFi
5. Log into Google Play account and install the 6 apps we actually use
6. Make LauncherPro the default desktop, set it to only use 1 dock and 1 desktop, set a plain boring background, hide all except the app drawer icon, and have and icon for our app, and an airplane mode widget on the desktop.
7. Finally, enter the server connection settings in our survey app (this part we’ve gotten to a point where all we do is drop a config file to the SD Card, and it picks up the settings for this particular app)
8. Turn off the phone, and do it all again on the other 99 devices…
Any thoughts on how to automate this?
I have tinkered with Tasker on previous phones and generally managed to get it to do some useful stuff, though I am no expert. I have recently started playing around in Tasker again on a rooted Note 4 (SM-N910F), and I have noticed that things don't always work as expected... I know, I know... check for typos, user error, etc.
In an effort to debug a task that deals with appending characters to multiple variables, I deleted all non essential profiles, tasks and scenes, leaving 4x tasks (with less than 4 actions each) and 1x scene. I can append single digit numbers to one variable no problem, but in another variable I wanted to append a single "." at a time. This was not appending anything to the variable, so I changed the appended character to "o" instead. Lo and behold the variable in question is now appending "."s when that task is run. A lot of the errors (there have been some weird ones!) I have been seeing recently could be explained by some tasks and variables acting like previous/incomplete versions of themselves.
Is this something anyone else has experienced? I have a backup of my Tasker for anyone who wants to nose around in there to make sure I'm not calling "%Sanity eq 1/%Sanity" or other such nonsense. Just not sure the best way to get it to you. I am trying to build a custom PIN lock screen FYI. For those who do look around in there, the large grey button is an exit button so you don't lock yourself out of your phone, and the red button checks the entered PIN vs the stored one.
I downloaded and started using "terminal-launcher" as my homescreen (available from Google Play Store); it's amazing, simple, and has super-low-memory usage, but...
If you have multiple apps with the same name (I have two called Calendar and two called Messenger) it can only launch one of them (due to being text based and the names sharing text). I asked the developer if he could remedy but he (very politely) said he'd moved on and I should develop it if I wanted to. I have enough knowledge of java to know roughly what is going on in his script (roughly!), but not enough knowledge to make the change required, recompile, or pretty much anything really useful.
His script is on github.com/mattpvaughn/terminal-launcher but I can't post the link as I'm a newbie (but that basically was the link).
My theory is that either:
it appends app names (where multiples exist) with ~1, ~2, etc
it lists app ids next to the names (it lists app names when you type "apps" on your homescreen) and allows launch via app id
it does something more clever than I can come up with (this is the more likely option
To be honest, this is a great launcher that just needs a final polish (TUI console launcher crashes too much as it's script is too involved, this launcher has tried to keep script to a bare minimum); unfortunately there aren't enough comment lines to guide an inept idiot like me through adjusting the script.
Any ideas?