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
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
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
Feb 27, 2009
In an app with a small number of POJOs and lots of helper methods that operate on them, what's better performance-wise: to make the helper classes singletons or to make the methods static?
View 4 Replies
View Related
Aug 15, 2012
[URL] .... There was an update today that is said to make this app compatible with the Nexus 7, but the store is still marking my device as incompatible.
I need this widget to verify Tethering works correctly.
View 1 Replies
View Related
Jun 23, 2010
What exactly does this mean? Better signal or something If so I will be ditching my incredible like a 20 dollar hoe
View 22 Replies
View Related
Feb 15, 2010
I'm trying to handle exceptions at a global level. My understanding is that the only way to do this is with an UncaughtExceptionHandler. However, this reduces one to the primitive java file and network i/o packages. I'd like to be able to broadcast an intent or bind to a service. Is there some way to interact with the android packages to retrieve a context in a static manner? I could probably do some hack workaround with a thread local, weak-referenced context set at the time of the exception handler, but I'd rather avoid that nastiness.
View 4 Replies
View Related
Aug 21, 2010
I have a broadcast receiver that needs to notify a service that it has received a text message. The only way to do this (as far as I know) is a static method. But the method that is notified need access to the application's preferences.
Every method I have tried says that it cannot be accessed from a static method. So how do I access preferences from a static method?
View 2 Replies
View Related
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
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
Sep 26, 2010
So we have 2 Incredibles on a family plan and with this chatter of eventual data caps, I just was curious and took a look at our recent data usage on myverizon to see where we stand.I average about 5gb a month while my significant other is around 20gb! I am a moderately heavy web user (although I don't really have anyone to compare to, but I check the internet a lot during the day out of sheer boredom at work) and he by all means is not.Can somebody explain what exactly eats data and how it works? We are mostly just curious and are guessing it's an app. But *what* is doing it? Like does it draw data from the internet or something? Is that app updating or refreshing? The only thing I know about data is like if you refresh a page on the internet, then data is used. I refreshed a website twice and my usage according to 3d watchdog jumped about 1mb. Is that normal? Is it also normal for there to be data usage while your phone is asleep?
View 7 Replies
View Related
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.
View 3 Replies
View Related
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
Apr 29, 2014
I am using a MOTO X with android 4.4.2. The android OS has high background data usage only in cellular connection. There is no such issue in WIFI connection. I hav turned off auto backup, deleted Google+ and turned off all the syncs. Even after restricting background data the android os keeps using mobile data. I have done the factory reset once but even that didn't solve the problem.
View 1 Replies
View Related
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
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
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
Aug 23, 2010
Not sure if many of you have been following threads out there about very high data usage on standby - my experience.I went from using 5mb - 10mb a day to 100mb/day.Unbelieveable.I tried searching for everything I could to figure it out - all the way from Location Setting swithed on to Facebook having a Calendar sync'ing glitch where it perpetually sync'd - never stopped.Hence racked up Mb's.The problem, I believe, for my phone was the Gmail constantly sync'ing. I guess i have a few emails with large attachments - 3-5mbs. I thought once it sync'd it to my phone, it would not reload them. I had sync on every hour - so every hour - 5mbs were used.Needless to say, i have stopped the auto sync of my Gmail its on manual now, and better yet i will just be using IMAP instead of Push email, and the problem has been solved.
I am now back to normal use of 5mbs per day 10mb on the high side.And that is with Twitter constant, internet, Push to Talk, and World War game to name a few.If you dont follow your data usage, i highly recommend you do. There are horror stories out there of people having to pay $1000 extra. I will be owing prob an extra $50.00 or more due to this issue.(In Canada here on Bell Carrier monthly limit is 500mb) I recommend downloading 3G watchdog - really good at monitoring data.Anyway, just wanted to share this story, as I dont think there has been an HTC Legend thread. And that is the phone I have.
View 5 Replies
View Related
Jul 14, 2010
I've spent the last 2 hours listening to a mix of mp3's that were either pre-loaded onto my sd card and that I've added to it myself (40-60 split) and I've noticed on 3G watchdog that my usage has shot up 40% odd!Why has this happened when I'm listening to stuff from my sd card?I have installed the last.fm app for what it's worth, is it doing soemthing it shouldn't be? I've had a look in my task manager and there is nothing obvious running that shouldn't be, if that makes sense.
View 8 Replies
View Related
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
Mar 7, 2010
I've noticed a few people have complained about high standby data usage.. ie when you leave the phone on a desk, with nothing streaming, you still manage to use up 1-2mb per hour (as I was!). This is a big problem for people moving from something like a blackberry where it was hard to use up a lot of data even if you tried.I tried disabling as much as possible to see what was causing the problem (NetSentry was great for tracking usage but of course can't tell you which programs/services are using it up), and after exhausting all ideas I tried deleting the two non-GMail email accounts I had. On was set up as push Exchange, and the other a 15-minute polling POP account. I have to assume it was the Exchange that was the problem, but I can't be sure. In any case, my usage dropped from about 4MB over 3 hours to about 12kB for the last 3 hours since I disabled the accounts.In conclusion, email can be more of a problem than you think! I'm going to forward my other accounts through my GMail to see if that works better.
View 43 Replies
View Related
Oct 20, 2013
I migrated from Mororola RAZR (XT910) to Alcatel One Touch Idox X (6040D) on both phones I have the same applications, but on the Alcatel it happens again and again that out of nowhere suddenly Streaming media starts to download a huge amount of data, until I restart the phone.
-Google backup, location, photo sync is OFF
This behavior happens even if the Apps such as IMDB, YOUTUBE, POWERAMP are force closed. I used Watch dog 3G so My Data Manager, but both of them just show "streaming media" as the process eating the data. As Youtube was noted in System data consumption I could set there Background data limitation, which worked a little bit, but the issue continues, like some other application would try to take over YT misbehavior
Yesterday the phone "streamed" like this 6GB of data on WIFI and almost 700 MB on mobile, last month with XT910, I lasted with 700 MB mobile data for more than 2 weeks.
View 1 Replies
View Related
May 23, 2010
I'm looking into writing an Android game, tough I don't curerntly own an Android device. For those of you who own a device, how does the performance on the emulator relate to real device performance? I'm especially interested in graphics related tasks.This obviously depends on both the machine running the emulator, and the specific device in question, but I'm talking rough numbers here.This question is a duplicate, but since that post is heavily outdated, I figured it's irrelevant by now.
View 3 Replies
View Related
Aug 9, 2010
Dear Android geeks, I am new to android development, and i want to develop an app in which u can set some data and location in google map and at a later time we can retrieve it also. Please help me out with it I am not able to set data in maps.
View 20 Replies
View Related
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
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
Jun 6, 2010
I'm heading to Halifax, Nova Scotia for a week and will be bringing my Hero with me. I'll be calling Sprint customer support to see what options are available for voice and data, but I trust the advice of folks in this forum.
Is there any international voice and data plan that i can sign up for so that I don't end up paying sky-high roaming rates? I really don't want to have to keep my phone in airplane mode the whole week. Any advice from travelers to the "Great White North" would really be appreciated, eh?
View 13 Replies
View Related
Feb 20, 2010
Motorola CLIQ Over-the-Air Update
[Retail Partner Sales - T-Mobile Employees and Authorized Dealers]
February 19 Update
The over-the-air update for the Motorola CLIQ has been delayed to the week of February 22. An updated article will be available once a date has been determined.
On February 18, Motorola will begin sending over-the-air (OTA) software updates to Motorola CLIQ customers. The software update will improve device performance and resolve several known issues.
Improved Performance:
Improved battery life
Improved software performance and stability
Improved widget response
Decreased Force Close error messages
New Manage SIM Card application
Support of .WMA and .WAV media files
Removal of the imeem mobile application
Known Issues Resolved:
Accessories & Bluetooth
Error: 'Unable to pair' or 'Unable to connect to device'
Call functions
Can activate other functions while listening to visual voicemail
Call not ended by pressing the End key
Speakerphone turns on unexpectedly when answer incoming call
Plays ringtone or vibrates while on an active call
Unable to answer incoming call using �Slide to answer� feature
Accidentally opens Dialer or makes outbound while holding device
Device hardware (battery, keys, power, screen)
Battery indicator may not display accurate battery power
Call not eded by pressing the End key
Touch screen issues
Cannot answer incoming call using the Slide to answer feature
Incorrect keys registered using on-screen keyboard
Touch display appears to have �dead spots� that are unresponsive
Accidentally selects item when trying to flick through screens or menus
Messaging
Wrong message deleted
Phone may reset when turning Wi-Fi off in area with no Wi-Fi coverage
Customers can manually download the OTA on demand by going to Settings > About Phone > System Updates. Customers do not need to wait for a notification message to download.
Action Steps
Be aware of the fixes and enhancements included in the Motorola CLIQ update.
If customers are experiencing any Known Issue that will be resolved by the software update:
Do not file a handset exchange
Advise customers that the issue will be resolved by a software update on February 18.
Important Rebate Changes
[Retail Partner Sales - T-Mobile Employees and Authorized Dealers]
Customers eligible for rebates as part of new activations or upgrades must be advised they will receive their rebates in the form of a prepaid Visa card.
When customers take advantage of our new Early Upgrade or Early Upgrade Plus options, they are not eligible for upgrade rebate cards. These new upgrade options allow customers to take advantage of upgrades sooner and provide an instant discount, instead of having to wait for rebate cards.
To be eligible for an upgrade rebate card, customers must meet upgrade eligibility requirements.
Current, 1-year contracts: 11 or more active months since last discounted handset purchase.
Current, 2-year contracts: 22 or more active months since last discounted handset purchase.
Rebates on eligible purchases require contract extensions and a $9.99 or higher Data/Messaging feature.
Valid only on FlexPay plans with 1 or 2-year contracts.
Not valid for Even More Plus plans.
Active Months: The number of months in which the account has been in good standing and during which service has not been suspended.
Action Steps
Inform customers that Early Upgrade and Early Upgrade Plus are not eligible for upgrade rebate cards.
Advise customers eligible for rebates that they will receive their rebates in the form of a prepaid Visa card.
"With the purchase of your new handset, you can submit a rebate form to receive your rebate. The rebate will be in the form of a prepaid Visa card that can be used anywhere Visa is accepted. See the rebate form for additional details."
Trackball Replacement Program
[Retail Partner Sales - T-Mobile Employees and Authorized Dealers]
On February 24, T-Mobile will launch a Trackball Replacement program for BlackBerry Pearl 8100/8120 and BlackBerry Curve 8320 customers that are having trackball issues. This program will be available in T-Mobile retail stores only at this time.
Action Step
Refer customers to a T-Mobile retail store after February 24 for further assistance if they come in to your location looking to complete a trackball replacement.
First Connect for Dealers
[Retail Partner Sales]
First Connect for Dealers is an exciting class designed to help on-board and prepare Retail Partners to successfully sell T-Mobile products and services and provide differentiated customer experiences. This four hour class is conducted via the T-Mobile Live Virtual Classroom and covers the following:
Welcome to T-Mobile
Who is T-Mobile?
PCC
Differentiated Handsets
Differentiated Rate Plans
Service Excellence / Selling Skills
Tools and Resources
Customer On-Boarding
The attached flyer contains dates and times for these calls as well as registration details. ADRs should educate their locations about these calls and encourage them to attend.
To successfully be able to attend the training sessions, Retail Partners should have the following:
Computers with high speed Internet connections
The ability to play and hear video segments on the computer using speakers or headset
The use of a fully charged mobile phone to hear the audio portion of the conference call
Printer access to print Participant Workbook.
Action Steps
Share the attached flyer with your locations and encourage them to attend one of the scheduled calls.
View 1 Replies
View Related
Jun 12, 2010
My speaker buzzes all the time on my phone (not the speaker phone - it works fine). It's not a network buzz, it's a vibration buzz of the metal or speaker. The center camera is also off-center a little bit, which makes me think something up there is off-center, misglued or loose.
We have two other evos and neither of them buzz on the same call. I called the Sprint Nav Voice Address thing from all 3 phones since that would be the exact same voice and words every time. Only mine buzzes. The other two don't have the camera problem either.
View 3 Replies
View Related
Jul 22, 2010
I have a Windows web server already set up with a website (unlimited application pools) and I want to be able to access a database on that server via the Android app I'm developing. How can I do this? Can someone point me to a tutorial or give code example of how this cross-platform (Android/Java to ASP.NET/C#) communication can be done? (I'm trying to create a leader board or global scoreboard for my Android game on my server.)
View 3 Replies
View Related