Android :: How To Reset/clear Application Preferences During Unit Testing
Oct 8, 2010
I want to start with a consistent test environment so I need to reset/clear my preferences. Here's the SetUp for test I have so far. It's not reporting any errors, and my tests pass, but the preferences are not being cleared.
I'm testing the "MainMenu" activity, but I temporarily switch to the OptionScreen activity (which extends Android's PreferenceActivity class.)
I do see the test correctly open the OptionScreen during the run.
CODE
:...............
StartNewActivity Code:
CODE:.................
View 1 Replies
Aug 6, 2010
I'm new to android unit testing. I'm trying to write a unit test for the Phone application:
package com.android.phone;
import android.content.Intent;
import android.net.Uri;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.android.phone.PhoneApp;
import dalvik.annotation.TestTargetClass;...............
View 3 Replies
View Related
Jul 14, 2010
I was finally able to build and debug the android platform (the process can be seen here). Now, the question is: where are the unit tests, how do I launch them and where do I see results? And also, is there any guide to android platform architecture?
View 1 Replies
View Related
Nov 17, 2010
There is no way to load a string from a specific locale's language file.
What I want to do is run all my locales' (I have 24 of them) time format strings through unit tests to make sure they don't crash. For example, here's a date format string in French: "'Hier à ' h:mm a".
These really need to be unit tested, because translators aren't great about properly escaping these strings, causing crashes unless we manually verify every string in every language every time we get a translation pass back.
This question has a sort-of answer. Is that really the only way? Is there a better way to specify the locale of a Context in unit tests?
View 1 Replies
View Related
Jul 3, 2009
I my main app and tests are organized like this (standard from "android create project"): AndroidManifest.xml assets/ main app asset files src/tests/AndroidManifest.xml -- uses <instrumentation> to point to the main app assets/ -- test-specific asset files src/ Writing test cases with AndroidTestCase, I'd like to load asset files from the test-specific assets/ directory, not from the main app assets/ directory. How can I accomplish that? The normal way to load an asset would be getContext().getAssets().open ("foo.txt"), for assets/foo.txt in the main app. I assume I just have to somehow change the Context or the AssetManager to point to the test- specific assets directory, but I don't see any way to do that. I have looked into the tests/bin/MyApp-debug.apk to confirm that the test assets are in there. Now I just need a way to access them.
View 2 Replies
View Related
Oct 5, 2010
I have a class that uses a Handler for a timed, asynchronous activity.
Something like this:
CODE:.................
View 11 Replies
View Related
Mar 30, 2010
I'm trying to start unit testing on my application (should have done so from the beginning). I've got an Eclipse project structure set up and everything seems to work well, but...
I'm subclassing SQLiteOpenHelper to access the application database. This works well for the application, but when using the same class in the unit tests, it writes to the same database as the actual application. This is obviously rather irritating, since unit test data shows up when developing and testing the actual application.
What's the best way to make the SQLiteOpenHelper class write to a different database file when being called from the unit tests?
View 2 Replies
View Related
Dec 6, 2009
I have a very simple activity created with one seek bar. I'm trying to figure out how best to unit test the events.
Below is how I have the seek bar wired up in my activity.
CODE:.........
So with this I have a test class that extends ActivityInstrumentationTestCase and I have test method.
Should I not be able to so something like this? Right now I'm getting Test run failed: String resource ID #0x2 with this code.
CODE:....................
View 2 Replies
View Related
Oct 27, 2010
I'm trying to run unit tests on my Android app and I'm getting a NoClassDefFoundError when referencing 3rd party jars.
The classes in those jars are only referenced by the app itself, not the unit tests. The jars are on the apps classpath and have been exported in the eclipse settings to allow tyhem to be found by dependant apps - which, of course, the test app is.
View 1 Replies
View Related
Feb 22, 2010
I need to run unit tests for code that references SQLiteDatabase for my Android code; however all my attempts to instantiate this object outside the emulator (on my desktop machine) have failed. JDBC on Android is not being recommended on the Net, hence it's out of the question (I could have provided mock objects very easily that way).
View 2 Replies
View Related
Oct 11, 2010
My preferences section contains user names and passwords that, if trashed, render the rest of the app non-functional. How can I keep the testing monkey's grubby fingers out of the preferences?
View 3 Replies
View Related
Dec 18, 2009
What is the easiest way to create some kind of test harness for Android apps and to be able to visualize (even on the emulator) what is going into the db? I want to test things like constraints, look at the data, unit test methods, etc. Is there any kind of GUI tool that I can hook up to the emulator to be able to look at the db of a particular app while I'm developing/testing, or are my only options the adb shell and creating test Activities within my app?
View 1 Replies
View Related
Jan 27, 2010
I want to test parsing of data returned from server.I thought I might create several test XML files and then feed them to the sax parser which uses my custom data handler (as in the application that I test).But where should I put those test XMLs?I tried with [project_root] /res/xml, but then I get the error: android.content.res.Resources $NotFoundException: Resource ID #0x7f040000 type #0x1c is not valid at android.content. res. Resources. loadXml ResourceParser(Resources.java:1870)at android.content.res. Resources. getXml(Resources. java:779) Does that mean that the xml is invalid, or that android couldn't find the XML file?(I use the same XML that comes from the server - copied it from the firebug's net panel and pasted into the file).Can I somehow read that XML as a text file, since etContext(). getResources() .getXml (R.xml.test_response1) returns XmlResourceParser instead of String (which I'd prefer)?
View 1 Replies
View Related
Sep 2, 2010
From what I can incur out of the SharedPreferences documentation, I can update a preference, add one or clear all preference values in a shared preference file.
But I want to completely clear everything inside a shared preference file, not just the values, but the preferences they refer to as well.
View 2 Replies
View Related
Jul 5, 2010
What's the best way to clear the notification number when the user clicks on the notification? I say the best way, but really I haven't found ANY way. I'm launching a built in activity when the user clicks on the notification, not something I wrote so I can't clear it that way. I've got the notification manager's flag set to clear.But whatever I do the Notification.number keeps going up and never resets to 0.
View 1 Replies
View Related
Dec 25, 2011
On a X2 how do you clear the search history of the search app? I'm not looking to clear the google history in the browser, I want to clear the google "quick search" history. This is the search that is associated with the voice search in the app tray. Do I need to do a factory reset? If I do need to how do you do a factory reset?
View 1 Replies
View Related
Jan 24, 2010
I have done a hard reset because I sold the phone. How do you delete anything that might be on the SD card?
View 3 Replies
View Related
Sep 9, 2009
We are working on an application that is a "Black Box in a phone" Written only for Android at the moment, we have tested on T1 and Magic, and we are looking for people to help us test it in various circumstances.
The app is designed for pilots and those that fly, tracks the phone in realtime and displays it on others phones and also in 3D on the website, GPS Logbooks - Home | Black Box Flight Recording, using only your Android cell phone.
The app is now in the marketplace, so we are looking for pilots, navigators, glider pilots, balloonists, sky divers and anyone else who likes to fly to download the app and go flying. After that you can publish your flights and share them with others.
Please note that your location data is visible to anyone on the site when you are flying live, so don't use it if you are somewhere that you don't want people to know about.
View 1 Replies
View Related
Apr 22, 2010
I am using a PreferenceActivity to let the user set some values. I am feeding it the xml file with the defined preferences.
I have set all the android:defaultValue="" for them.
When I start my application, I need the preferences, or if they are not set yet manually, I want the default values:
CODE:.................
However, when android:defaultValue="true" I still get false. So, it looks like the defaultValues set in the XML are not used anywhere but when initializing the preferences-screen.
I don't want to hardcode the default values in the getBoolean() method. So, is there a way get the default-values with only defining these in 1 place?
View 2 Replies
View Related
Oct 3, 2010
I am currently running a rooted Samsung Captivate. I have not flashed it or anything and am still running 2.1 with the firmware update (JH7). I rooted to get rid of AT&Ts bloatware which I did using System App remover. With Froyo on the way, I was wondering if a master reset would turn it back to stock (minus AT&T bloatware) and enable OTA updates again?
View 4 Replies
View Related
Oct 24, 2010
Accessing the shared preferences of another application.
View 3 Replies
View Related
May 12, 2010
I have a app that only consists of 2 services and a broadcast receiver (they check the internet periodically). I need to store preferences that can be shared across those services. Is this the same as for an activity? Just use getsharedpreferences()? This doesn't seem to be documented very well.
View 1 Replies
View Related
Jul 26, 2010
I have been looking for a method to change the default SMS application's preference programmatically.
I found that those preferences are stored as "shared preferences", probably in data/data/com.android.sms/something.xml, but I am not able to get to that directory since I haven't rooted my phone.
Do you have any clue?
View 2 Replies
View Related
Oct 2, 2010
So I did a factory reset and all of my downloaded applications were still there. I thought it clears all of your downloaded apps and it was supposed to clear all of my settings. Such as display and sound settings which it also didn't do. Is this the way its supposed to work or not.
View 17 Replies
View Related
Apr 17, 2010
I bought an Eris which I love, but will probably take it back within the 30 days to get an Incredible. Just wondering what's the best way to clear all my info & downloaded apps off the phone so it's back to the way it came in the box?
View 2 Replies
View Related
Jan 27, 2013
Why the phone memory did not clear even i use the data wipe/factory reset... how can i clear that?
View 6 Replies
View Related
Nov 16, 2010
This comes up because I am changing the model for my freed and paid apps. Besides all the other things I need to figure out to build this (I'm trying the library method), I'd like to transfer preferences smoothly from DEMO app to paid App. I'm sure that some of you are old hands at this and can give some advice. I've tried the Demo and License, where a license app will unlock the Demo app and make it full.
The Market users can't handle that. My customers didn't want to have two app icons once they installed the license. So I made it invisible. Now I have users that say they can't "open" the license after purchase. It states very clearly in the app description that they need to install the free version first, but I've discovered that not everyone reads that vast 325 character description before buying even some of the most expensive apps on the Market.
I've decided not to fight it. I do believe that customers will be more happy overall and there will be less refunds, if they do try the demo app first. It gives them 16 days to try instead of 24 hours to get a refund. But I'm not going to force that. So, I'll be going down the Demo and Full model route. Just as an aside, I really wish the market would support time limited trials. There is difference between real support and faking it as I have been.
View 17 Replies
View Related
Mar 9, 2010
I'm having troubles with users that report that if they leave the application opened and after a few hours when they return to it the app crashes. I'm pretty sure it is because I'm not storing/restoring the status correctly when my process is killed by the system, but I would like to be able to test it in a repeatable way. Which is the best way to simulate the same behavior that happens when Android kills my process on low memory conditions?
View 4 Replies
View Related
Feb 24, 2010
I wrote a simplest test based on android.test.ActivityInstrumentationTestCase2.
CODE:..............
View 2 Replies
View Related
Oct 2, 2010
What are different points to note down while testing android applications? What are different techniques or test cases used for android?
View 1 Replies
View Related