Android :: Static Data Structures On Embedded Devices

May 2, 2010

I've started working on some Android applications and have a question regarding how people normally deal with situations where you have a static data set and have an application where that data is needed in memory as one of the standard java collections or as an array.

In my current specific issue i have a spreadsheet with some pre-calculated data. It consists of ~100 rows and 3 columns. 1 Column is a string, 1 column is a float, 1 column is an integer. I need access to this data as an array in java.

It seems like i could:

1) Encode in XML - This would be cpu intensive to decode in my experience.

2) build into SQLite database - seems like a lot of overhead for static access to data i only need array style access to in ram.

3) Build into binary blob and read in. (never done this in java, i miss void *)

4) Build a python script to take the CSV version of my data and spit out a java function that adds the values to my desired structure with hard coded values.

5) Store a string array via androids resource mechanism and compute the other 2 columns on application load. In my case the computation would require a lot of calls to Math.log, Math.pow and Math.floor which i'd rather not have to do for load time and battery usage reasons.

I mostly work in low power embedded applications in C and as such #4 is what i'm used to doing in these situations.

It just seems like it should be far easier to gain access to static data structures in java/android.

Perhaps I'm just being too battery usage conscious and in my single case i imagine the answer is that it doesn't matter much, but if every application took that stance it could begin to matter.

Android :: Static Data Structures on Embedded Devices


Android :: Embedded Hardware Devices?

Sep 1, 2009

I'm playing around with an idea in the back of my head, was wondering if there were any Android devices that had touchscreen and wifi - no other requirements necessary. The GiiNii Movit Mini is as close to what I'm looking for as I can find. Are there hardware vendors that make custom Android products such as this? Inexpensive, ARM or MIPS, run Android, touchscreen, wifi, that's it.

View 9 Replies View Related

How To Parse Binary Data Into Structures

May 15, 2014

I primarily do hardware and firmware design, but a new product my company is developing has the need for an Android app and since I have the most Android programming experience (which is extremely limited) that leaves the task to me. I need a little guidance figuring out how to do a few things so that I can get this app up and running. I already have a simple GUI to display some stuff, but what I need is a way to handle data.

I am trying to receive a 148 byte stream of data over a serial connection, parse it into a structure and display certain values from that structure. The data is packed in a struct that is sent from a micro controller and due to that it has a very specific layout (i.e. the first 8 bytes mean this, the next 16 bytes are this... ). In C, I can just declare a struct with those values and use the #pragma pack function to eliminate any extra spacing the compiler would otherwise inject for alignment purposes, receive the data and do a memcpy into the struct to write the data. It's not the safest or cleanest way to do it, but it takes very little time and if you do CRC tests to make sure the data received is valid it works like a charm.

Now to the root of the problem: How do I declare structs in Java? Is there a way to pack them tightly like you can using C? Once I've received the binary data, is there a way to parse it into the structure easily? These are the issues we hardware programmers face when dealing with Java...

View 2 Replies View Related

Android :: How To Pass Complex Data Structures Between Service And Remote Binder?

Feb 17, 2010

The object passing between an Android service and the remote binder is happening through serialization of the object. If the service needs to return a very large collection, it seems very inefficient to use this. What is the recommended way to deal with this?

View 1 Replies View Related

Replace Single Row View In Custom STATIC ListView - STATIC Data

Mar 18, 2013

I have Eclipse Juno and I'm working on an app with that.

The main activity will have a scrollable menu that takes you to all the other activities.

So the general structure/outline right now:[HIGH]Relative Layout ImageView (header logo type thing) ListView (the actual scrollable menu)[/HIGH]Here's the problem though... I can't find any simple list tutorials. I can easily make a single line list work but I need to make a two line list and one that is static, not dynamic and no examples are out there for that. It's like if you want to make a 2 line list, you can only learn how to do it in the most code-heavy ridiculous way possible.

Essentially what I am looking for with the list is this: Item one: Centred, bold, non selectable title (Resources)

- Item two-??: two line list items, click-able to a new activity, title of the section on first line, description on the second line.

- Item ??: Centred, bold, non selectable title (Tools)

- Item ??-??: two line list items, click-able to a new activity, title of the section on first line, description on the second line.

Nothing dynamic that is ever going to change, no super complex wonkey calculations, just to simply have the data set in stone (preferably via XML) and to call it into the list.

I experimented with some of the other list views and no matter what I did, I could get, via editing the resources and NOT using Java, more that one item on a single line but it wouldn't format it properly according to the layout I guess because I haven't got the ID correct or whatever I don't know.

I mean, all the examples I've seen for a 2 line list are extraordinarily over-coded and just bloated. I mean I have a website I am still working on in C#/ASP.net that has far more complex things in it with half the code that I've seen for the examples of the two line lists.

I tried on my own to figure it out (I am decent with C# and vaguely familiar with Java, self taught, and programming for some other systems like Python, again all self-taught), but like ALL coding references, they're organised by the actual code you implement (that you don't know) instead of by what you want it to do (so you have to search the whole code base to find something that you don't know what it's called but know what it does). >:C

View 10 Replies View Related

Android :: Save Data Structures In Android?

Sep 24, 2009

I want to store some data from structures like this:

...........................

I want to save it to an external file on the sdcard of my device so that other apps can read it (and users can open/copy it). I thought I should use a DOM parser because my data structures are not very big, but I find no tutorials or anything like that. Is there a better way to store this information? how to use the parsers in android?

View 1 Replies View Related

Android :: Storage Of Static Data Within App

Jul 28, 2010

I am currently developing a simple info app on various uni campuses. I want the app to operate predominantly in an offline state thus I want to store all my information locally. The data within the app will not be subject to any change thus I was wondering what the best (practice) method was to store such data? Basically should I be storing the info in a SQLite db, java file or xml?

View 3 Replies View Related

Android :: Put Static Data Into SQLite Database?

Jun 8, 2010

If I have a bunch of data that is never going to change (eg. an English language dictionary or the rgb values of a couple hundred color names), how do I use an SQLite database to store it? I know a database is faster than loading everything into memory when the app starts, but how do I make the database either the first time the app runs or "before" the apps ever runs?

View 2 Replies View Related

Android :: High Performance Access On Static Data

Nov 24, 2009

I am writing a program where I have to access some static data, and now I am looking for the best method of how to include them into the project.Reading in the data by parsing an XML is *slow* (even using the SAX parser). 2. Reading the data by parsing a CSV file is faster than loading an XML, but again is too slow. 3. Putting the data into a Java file directly (e.g. by defining an array) fails because Dalvik says it is too large. 4. Reading in the data using serialization is slow. The funny thing here is: It takes a bit longer than loading the XML file. 5. Reading in the data from a SQLite database is the fastest method until now. But a bad workaround is needed: A SQLite DB can not yet be read directly from the resources, but instead has to be copied to the cache or to the SD card - even for read-only access. Right now I am using method 5, but I would really like to use a more simplified and faster solution.

What I found out: Unserialization in Java is *fast* (reading a HashMap with 5000 integers and strings in 79ms on my PC), while the same action on my G1 takes over 13500ms. I know that I can not compare a PC to a mobile device. But still, there seems to be a big difference here. I think that the JRE directly copies the serialized data to RAM, while Dalvik seems to read every object step by step. Is this going to change in the future? And, most interestingly: what do you do to access lots of static information?

View 12 Replies View Related

Android :: AutoCompleteTextView Static Data / Slow Performance

Jun 1, 2010

I am facing the following problem: I have a big list of street names(~2000 entries), which is stored as a variable. I have an AutoCompleteTextView which should complete the names. The process takes really long time(approx. 2 - 3 seconds) to complete the suggestion. Is there any way to speed this up? I am pasting my code, if this is necessary:The getStreetsData() method simply returns the static list of the names.

View 2 Replies View Related

Android :: BroadcastReceiver For Data SMS - Static Works - Dynamic Does Not

Mar 29, 2009

I have created a broadcast receiver statically by specifying it within the Manifest, and I have also created the "same" broadcast receiver in code and have registered it with the application context. The static way works very well, but the dynamic way does not receive the expected broadcast. It could be that I am not creating the intent filter correctly, or that I need to register it with some other context somewhere. Please see the code examples to see what I am doing. This is related to receiving data SMS, it works very well on a device using a broadcast receiver defined in the Manifest. The correct permissions are set for both examples.

The following is from the Manifest, and the resulting receiver gets the expected broadcasts:

CODE:.....

The following is the code example that doesn't work (it does work with an intent like "android.provider.Telephony.SMS_RECEIVED" but not for data sms):

CODE:.....

The question is - why does this broadcast receiver get notified of the incoming data messages? It seems some other resource is notified when the Manifest version of the receiver is created...

View 4 Replies View Related

Android :: Call Non Static Method In Static SQLiteDatabase Class

Mar 30, 2010

i want to display a msg to the user (msg box or Toast) when exception happend in a static SQLite Database class that i use. the problem is that i cant call a non static method in a static class , how can i handle this. this is the class

private static SQLiteDatabase getDatabase(Context aContext) {

and i want to add something like this in the class when exception happen but context generates the problem of reference to non static in static class.

Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();

View 1 Replies View Related

Android :: Cannot Make Static Reference To Anon-static Method

Feb 7, 2010

I'm having some issues with the old "Cannot make a static reference to a non-static method" error in my Android program. I am creating a sand falling game (similar to the Powder Game) and I created a class called Control to create a Control Bar at the bottom of the screen with a slider for brush size (that works fine) and a button to pop up a Dialog to allow users to pick the selected element. However, when I call DemoActivity.showDialog(2) from my code, it gives the static reference to non-static error (DemoActivity is the main activity of my application). I also tried changing it to just Activity.showDialog(2), but I got exactly the same error!

Here's my code:

CODE:................

I fixed it by adding the following to my Control.java code:

CODE:..........

And then calling control.setActivity(this); from my onResume section of DemoActivity.java!

View 2 Replies View Related

Android :: Non-static Method Cannot Be Referenced From A Static Context

May 26, 2010

I am modifying the source code here: http://thinkandroid.wordpress.com/2009/12/30/getting-response-body-of-httpresponse/

I get this error:

code:.............

This error is line 13 on the second box.

View 5 Replies View Related

Android :: Creating Static Data Structure On Application Startup For Android

Oct 27, 2010

In my application, I am going to create a few listviews that are dependent on the listview before it. For example,Then, depending on user choice, will go next screen, let's say, it contains a submenu of each type of school,that may be different or may be the same to other states.What I want to know, is how to populate these different lists dynamically as the user goes on? I don't know what the best of doing this is, and I seem to be looking in the all the wrong places because I keep getting stuck. Once all the data is added into whatever structure is used, it will be static. I basically just need help as to how to code information into some sort of hashtable or anything of the sort that can be easily referenced, and later when the Application is updated, be able to add more schools/states/submenus etc.

View 1 Replies View Related

Android :: Reading Data From Health Devices Via USB

Feb 8, 2010

Does android support reading data from personal health device via USB?If so what are the drivers and interfaces required for developing the same?

View 1 Replies View Related

Android :: Is It Efficient To Use Text File Or XML File To Store Static Data

Jul 31, 2009

I have some reference data in a text file (~5MB) that I want to use with might android application.The file is of the format:
1|a|This is line 1a
1|b|This is line 1b
2|a|This is line 2a
2|b|This is line 2b
2|c|This is line 2c

What I want to know is the most efficient way (less memory, fast, size etc.) to use this file within my application.

a.) Should I save the file as a raw resource and open and read the whole file whenever I need a certain line.
b.) Should I convert the file to XML and use XPath to query the file when ever I need to look up a value
<!--sample XML -->
<data>
<line number="1">
<entry name="a">This is line 1 a</entry>
</line>
</data>
c.) Should I just copy & paste the whole file as a static string array in the application and use that.
[EDIT] I will also need to search this file and jump to arbitrary keywords e.g. "line 1a".

View 4 Replies View Related

Android :: Static Vs Non-static Inner Classes

Mar 9, 2009

I have been finding it convenient to extend Handler in many of my activities to handle messages specific to the activity. The handler sublass is an inner class of the activity and needs to access its state. I am wondering if there is any performance difference between making the handler subclass static and passing in the activity explicitly in its constructor or making the subclass an "instance class" and letting the vm worry about my accessing members of the containing activity.

The static approach:

CODE:.............................

View 4 Replies View Related

General :: Why Do All Android Devices Constantly Receive / Send Data Traffic

Apr 14, 2012

Why do all Android devices constantly receive/send data traffic? Even though no app is requiring it for that moment.During a one minute period the data traffic light light up at least once.

View 2 Replies View Related

Games :: Build Structures Out Of Marshmallows / Spaghetti Noodles

Oct 10, 2010

Messing around on AppBrain I found a new game, Spaghetti Marshmallows. The idea is to build structures out of marshmallows and spaghetti noodles, to reach given points on the screen. What seems to be a very simple game on the surface, actually requires a very strategic planned out execution.

View 15 Replies View Related

General :: App / Data Sync Between Two Devices?

Dec 28, 2013

I'm trying to find a one-way solution to sync 'app' & 'data' between 2 devices, and possibly make a full backup if ever needed.

I cannot get an idea of what each of the apps below do without downloading each one and making a mess. I was hoping some of you could shed some light. Considering these apps use a cloud service of sorts, I am assuming that old versions of files can be retrieved (from trash) by visiting the cloud service on a PC?

1. Titanium Backup Pro
2. DataSync
3. DropSync
4. FolderSync
5. Helium

View 1 Replies View Related

KitKat 4.4 :: Easy Way To Transfer App Data Between Devices

May 1, 2014

I found an easy way to transfer app data from one android device to another. Recently switched to galaxy s4 from iPhone 5 and wanted to transfer my app data from my nook tablet that is rooted. I installed es file explorer and helium (carbon) backup on both. Then I backed up the apps i wanted using carbon on my nook. Opened es file explorer and went to carbon folder and selected apps I wanted to transfer, clicked send to and it transfered the files to my s4. Then I put the files into the carbon folder on my s4. Then restored them using carbon. Now I have my Minecraft data on my s4!

View 3 Replies View Related

Transfer Data Between One Device As Host And Many Devices As Clients

Oct 9, 2012

What is the best way to transfer data between one device as host and many devices as clients .I want to transfer data(Values like string) from many devices to one in the same time .

View 1 Replies View Related

General :: Transferring Save Data For Games Between Two Devices

Mar 24, 2013

I was wondering if there was an easy way to kind Of"sync"or transfer gave data for various games between two device. I am more interested in resuming my save data of Hungry Sharks Evolution that I already have On my Note II onto my Note 10.1, but transferring for Games like 4 pics word or Angry Birds would be nice as well.

View 3 Replies View Related

General :: Syncing Two Devices - Moto Xoom And One X For Apps And App Data

Nov 10, 2012

I have recently bought a HTC One X and find it difficult to keep my Moto xoom and One X in real time sync for Apps and App data.

I have been through many apps and none are quick, easy and not internet hogging junk.

Now its not like iCloud where you download an app on one device and gets automatically pushed to your other devices quick and easy.

I know I'm not the only one with two or more Android devices and I want know how you keep your devices in sync?

View 2 Replies View Related

General :: How To Transfer TEXT MESSAGES From WP8.1 Devices To Android Devices

May 14, 2014

How To Transfer TEXT MESSAGES from WP8.1 devices to Android Devices ??And also the contacts!!

View 2 Replies View Related

Android :: Static Method In Java Accept Only Final Or Non Final Variables Within Its Method - But Not Static

Sep 15, 2010

Why should a static method in java accept only final or non final variables within its method, but not static?

For example I have the following method:

CODE:.................

View 6 Replies View Related

General :: Two Separate Google Play Accounts For Two Different Devices And One Gmail Account For Both Devices

Oct 2, 2013

Can I have two separate google play accounts for two different devices & keep one gmail account for both devices?

View 6 Replies View Related

Android :: How To Communicate With Embedded Activity?

Jan 30, 2010

In my current project I have a full screen TabActivity. Each tab content is handled by two instances of same ListActivity. Now, I put an extra int in intent to know which data should be displayed.So in onCreate method of my ListActivity, I check the int in extra and I build my query to obtain a SQLLiteCursor.I would like to dynamycally give to this two instances of ListActivity the list of item that should be displayed.I do not know what is the best way to do this. Any idea ?

View 1 Replies View Related

Android :: Progress Bar Embedded In Ui And Not In Dialog

Nov 22, 2010

Is there a way to embed the progress bar in the UI with out an dialog. And not programmatically but with layout xml files. I am guessing it has to be some sort of animation or a "drawable"

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved