Android :: Way To Test Serialization?
Oct 28, 2010
I am trying to implement serialization for an email application on the android (stroring username, password, server etc.), but in order to test it I have to close the application in the emulator and then re-open it to ensure that it looks and finds the file with the serialized objects. The problem is that when I close the application on the emulator uninstalls the application. I close the application with the finish() function. Any inklings as to why this happens? And it wasn't doing it until further along in my development stage.
View 1 Replies
May 30, 2010
I was trying to serialize an ArrayList which contains custom objects. I'm serializing it in a Servlet (server side), and deserialize at the client side. (using ObjectOutputStream and ObjectInputStream)
It worked fine, when I work with ArrayList<String>.
But when I tried it with ArrayList<MyObject> I couldn't get any results in the client side, this is the exception:
java.lang.ClassNotFoundException: web.MyObject
Of course I have done this:
public class MyObject implements Serializable { ... }
MyObject contains only String fields.
View 1 Replies
View Related
Dec 2, 2009
(Code is for Android Actually, I need code to be portable between Android and Java SE.)
I want to have a "settings" class with various game settings, like
public int map_size;
public String server_name;
etc.
The data needs to be accessed fairly frequently (so members, not a key-value map), and from time to time de/serialized in some standard way (mainly to send it through network).
I want to be able to
Serialize and deserialize the object into XML or JSON, without having to explicitly write the code for every member (but still having some degree of control over the format).
Define some (constant) meta-data about every member (default value, GUI name, XML identifier, ...), in a way that allows for easy modification in the source code (I want to be able to add a new meta-property, define a default value for it, and not have to specify it everywhere else).
1 is achievable by using reflection. I thought Java annotations for class members would be perfect for 2:
CODE:.............
But it looks like (user-defined) annotations don't work in Android yet - code using them crashes the compiler...
What would be the easiest way to store the meta-data about the settings (or another way to approach all this)?
Store information about settings in some external XML file? Store it in a Java data structure, with content defined in the code? Defining the data in this way somehow seems very unwieldy, especially compared to keyword arguments of annotations?
View 3 Replies
View Related
Jul 27, 2009
Finally after many days of getting StackOverflowError, I've tracked down the issue and fixed it, only to find that my game's serialization takes about 5 -10 seconds on the emulator and most likely around that in the target. So far my the lifecycle of my game is as follows
onCreate - check if serialization file exists, if it does, de- serializes it. (~ 5-10 seconds) onPause - if the game is not complete, then serialize it (~ 5-10 seconds) I remember reading somewhere that another activity's onResume will NOT get called UNTIL the previous activity's onPause has ended. So I am worried that my game is delaying another activity that wants to start from doing so i.e like a phone call etc. I think speeding up the serialization is not going to be feasible, so any ideas on what I can do? Can I serialize in the onDestroy instead of the onPause? I read that the onPause is the only safest place to store the state.
View 8 Replies
View Related
Sep 24, 2010
I'm writing an Android JUnit test and want to copy/reset a test fixture file (it's an SQLite database file.) If I were within the main application, I know I could just place the file in the assets directory and use getResources().getAssets().open(sourceFile).However, this API appears to be unavailable from the ActivityInstrumentationTestCase2 class.Is there an easy way to copy a file over from the testing PC, or should I just keep a fresh copy of a test fixture on the device and copy it over a temporary file?
View 2 Replies
View Related
Aug 23, 2009
I am using ActivityInstrumentationTestCase2 to do some test for an activity. I get a button in the setUp() method like this: protected void setUp() throws Exception {super.setUp(); act = getActivity(); btn = Button)act.find ViewById ( R.id.bike_button ); // this button has been defined in layout} Then I use this button to perform a click in a test method like this: public void testBikeButton(){ //click the bike button btn.performClick();}
View 7 Replies
View Related
Aug 11, 2010
I have never used JUnit before, and now I'm trying to set it up on an Android project.My project under test is fairly complex, including some JNI, but my test project, at the moment, is completely trivial. I have found many examples (that look totally different) online of how to make a test project, but it seems that no matter which one I follow, I get the same results.Here's my JUnit project code:package com.mycompany.myproject.test;
import android.test.AndroidTestCase;public class SimpleTestCaseExample extends Android TestCase {public void test_testOne() {fail("Just Always Fail");When I run, I see the following in Logcat:
stdout INSTRUMENTATION_STATUS: numtests=2
stdout INSTRUMENTATION_STATUS: test=test_testOne
stdout INSTRUMENTATION_STATUS_CODE: 0
stdout INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
stdout INSTRUMENTATION_STATUS: current=2
stdout INSTRUMENTATION_STATUS: class=com.mycompany.myproject.test.SimpleTestCaseExample
stdout INSTRUMENTATION_STATUS: stream=
stdout INSTRUMENTATION_STATUS: numtests=2
stdout INSTRUMENTATION_STATUS: test=testAndroidTestCaseSetupProperly
stdout INSTRUMENTATION_STATUS_CODE: 1
stdout INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
stdout INSTRUMENTATION_STATUS: current=2
stdout INSTRUMENTATION_STATUS: class=com.mycompany.myproject.test.SimpleTestCaseExample
stdout INSTRUMENTATION_STATUS: stream=.
stdout INSTRUMENTATION_STATUS: numtests=2
stdout INSTRUMENTATION_STATUS: test=testAndroidTestCaseSetupProperly
stdout INSTRUMENTATION_STATUS_CODE: 0
stdout INSTRUMENTATION_RESULT: stream=
stdout Test results for InstrumentationTestRunner=..
stdout Time: 0.07
stdout OK (2 tests)
stdout INSTRUMENTATION_CODE: -1
But, I get the following in the Console:Launching instrumentation android.test. Instrumentation TestRunner on device emulator-5554 Collecting test information Test run failed: No test results I have tried a variety of different things, messing with the basic TestCase class, or the TestSuite class, or a variety of other options. I tried to just go for the most trivial example because I'm really still trying to learn how this works.Whatever I try, I see this error.
View 1 Replies
View Related
Nov 9, 2010
I'm working on a school project and I'm researching testing possibilities for Android applications. On this page: http: // developer . android . com/ resources / tutorials /testing /hello android. Google writes about a unit test. Is this really a unit test? A Unit test will not integrate all classes and will not test in his context. So my opinion is it is not a Unit Test but an Integration Test.
View 7 Replies
View Related
Jul 15, 2010
One more video about the fancy touchscreen of the Droid X. This one has happier results! Check it out at the link below.Droid X Touchscreen Test See you later. you'll know why this post is short when you read the blog. running downstairs!
View 5 Replies
View Related
Nov 10, 2011
I have a project (that compiles and runs in the emulator.) I have a test project that tests part of this project. This test project also compiles with no problems, but when I try to run (test) it in the emulator, I get a NoClassDefFoundError exception on one of the classes my test class tests (I hope that made sense!) when it starts to run in the emulator. This is coming out of the adb log. I looked in the bin directory (of the test project) for the missing class, but could not find it... Should it be there? I found no reference (apk, etc) of the project I am trying to test either in the test projects bin directory. How does the test project get the classes it needs to test against (in the classpath, I assume.) How do the tested classes get moved to the emulator? I did try running the app before testing, so I know it is installed and runs correctly. BTW, I am using netbeans with the nbandroid plugin.
View 1 Replies
View Related
Jul 16, 2010
I am unable to integrate Junit with Android. I am using Junit 3, I have also tried Junit4.
package* com.android.test;
import* com.android.MyActivity;
import* android.app.Activity; *
import* android.test.ActivityInstrumentationTestCase2;
public* *class* TestMyView *extends *
ActivityInstrumentationTestCase2<MyActivity> {
Activity myActivity ;
*public* TestMyView(String pkg, Class<MyActivity> activityClass) {
*super*(pkg, activityClass);
myActivity = getActivity() ;
View 3 Replies
View Related
Mar 17, 2009
why CheckBox is always null.
<CheckBox id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" />
code file-
package com.reblogr.reblogrclient;
public class Test extends Activity { /** Called when the activity is first created. */
public CheckBox checkbox;
@Override public void onCreate(Bundle savedInstanceState) { ....................
View 5 Replies
View Related
Mar 3, 2009
I need a GPS application on android so I can test my gps function. Can any one who knows and being so kind to tell me about?
View 5 Replies
View Related
Feb 12, 2009
Need to test apk file on actual G1 device urgently.
Could any anyone with the device please help me on this?
View 5 Replies
View Related
Mar 9, 2009
For the OEM, on the product line,we need to test the earpieces whether it works well. so I want to write a application which will play sounds through the earpieces. i want to know how can i play a sound through the earpieces? or if there is a better way to test the earpieces?
View 3 Replies
View Related
Oct 21, 2010
I would like to test my code which check the availability of the Text To Speech lib on the device before using it. For this I need to remove the TTS service which is already installed on my device (HTC Legend). Do you know how to do this ? (I only found to stop the service not to remove it) ...
View 3 Replies
View Related
Feb 8, 2010
Is there anything to test the UI of an Android app like Jemmy for Swing?
View 3 Replies
View Related
Aug 7, 2009
I plan to submit an app for the ADC II. I wanted to know if it is required that I test my app on the Andoird Dev Phone? If it runs on the emulator is it safe to assume that it runs on an actual phone? The phone is pretty costly and will be useless for me after the contest. Is there a place I can rent the Dev phone?
View 7 Replies
View Related
Apr 18, 2010
Where do I copy the apk file on the Motorola Droid? Which directory? Are there any possible issues I need to be careful of, it's also my personal phone.
View 3 Replies
View Related
Jun 13, 2010
With froyo users can move a app to the sd card... How can i test if my app is on internam memory or on sd?
View 6 Replies
View Related
Oct 16, 2009
I am porting GPS to Android now. I have been look for many web site relate to Android GPS porting include this group. However, I also feel confused about that. I have some questions. Can anyone give me some suggestions and I will appreciate about that. 1.There are 3 files : Android.mk, gps.cpp and gps_qemu.c in hardware/ libhardware_legacy/gps. What is the functionality about the 3 files in directory gps. Should I modify the 3 files to implement GPS. In this web site http://www.netmite.com/android/mydroid/cupcake/development/pdk/docs/g..., it shows that anyone that want to integate GPS with Android should create a shared library named libgps.so refer to gps.h. My question is how to create a shared library libgps.so.If the libgps.so is created, where can I find it. What is the relation between libgps.so and libhardware_legacy.so. 3.How to test GPS if gps is implemented successfully. I know there is a gpstest tool in Android but I don't know how to use it. Can someone tell me the detail about gpstest tool provided by Android.
View 5 Replies
View Related
Aug 1, 2010
After a frustrating day of having the Emulator render lines strangely, and then discovering that my G1 renders them exactly as I expect, I am left to wonder how to test OpenGL (using GLSurfaceView).
Is the emulator sufficient to test code for correctness? I ask because I experienced the following on the emulator, but not on the G1, all using Ortho projection.
1) Line width depending on length! I drew a series of lines, most fairly short but several with endpoints close to the edge of the fixed- point number range. The long lines were rendered as wide. The short lines were rendered as 1 pixel wide.
2) Lines exploding to fill the whole screen when not appropriate to the scale (double the scale, line goes from 1/10th screen width to filling screen (or more).
3) Lines not appearing at all if horizontal.
Is the emulator a correct openGL implementation? If I see problems on the emulator, am I likely to see them on some hardware platforms?
Can I use my G1 as a reference platform?
Or do I need a whole slew of phones to verify that an openGl app (scientific graphics, not animated) works across all platforms?
View 17 Replies
View Related
Jun 17, 2010
Is there a way to test an APK file on the computer before installing on my new EVO?
Or maybe check it for a virus or such?
View 3 Replies
View Related
Apr 4, 2012
Is there any sort of automated test similar to this (The W3C Markup Validation Service) that can perhaps mark how the usability a mobile application is or whether it is secure etc.
Or is the best way to just give my prototype to testers and receive feedback.
View 1 Replies
View Related
Jun 24, 2010
i am working on android CTS test, i am getting API check time out error whenever i start test plan CTS, i followed the below steps for CTS test and also i mentioned my doubts.
CTS test steps :
1. Please download and install the Android 1.6 SDK on your machine.
2. Your phone should be running a user build (Android 1.6 and later) from source.android.com
3. Please refer to this link on the Android developer site and set up your device accordingly.
4. Make sure that your device has been flashed with a user build (Android 1.6 and later) before you run CTS.
5. You need to download the TTS files via Settings > Speech synthesis > Install voice data before running CTS tests. (Note that this assumes you have Android Market installed on the device, if not you will need to install the files manually via adb)
6. It is advisable to log in to the device with a test Google account, not an account that you actually use.
7. Make sure the device has a SD card plugged in and the card is empty. Warning: CTS may modify/erase data on the SD card plugged in to the device.
8. Do a factory data reset on the device (Settings > SD Card & phone storage > Factory data reset). Warning: This will erase all user data from the phone.
9. Make sure no lock pattern is set on the device (Settings > Security & location > Require Pattern should be unchecked.Google Confidential
10. Make sure the "Screen Timeout" is set to "Never Timeout" (Settings > Sound & Display > Screen Timeout should be set to "Never Timeout".
11. Make sure the "Stay Awake" development option is checked (Settings > Applications > Development > Stay awake).
12. Make sure Settings > Application > Development > Allow mock locations is set to true.
13. Make sure the device is at the home screen at the start of CTS (Press the home button).
14. While a device is running tests, it must not be used for any other tasks.
15. Do not press any keys on the device while CTS is running. Pressing keys or touching the screen of a test device will interfere with the running tests and may lead to test failures.
Doubts :
1) is it necessary to follow all the steps ?
2) for step 5, i copied the voice data to the SD card and if i follow step 8 it will erase all contents of SD card so how can i follow both step 5 and step 8 at a time...?
error message while doing CTS test on Device :
pvteam@pvteam-desktop:~/Desktop/android-cts/tools$ ./startcts
Android CTS version 2.1_pre_r1
Device(HT9A4LV00787) connected
cts_host > start --plan CTS
cts_host > There are 3 existing session(s) for plan CTS.
[code]...
the Device restart took place three times then i stoped the CTS test.
View 5 Replies
View Related
Apr 6, 2010
I published an app that works in all the emulators I've tried and on the two Android phones that I've tried. I've got the Droid and my wife has the Eris. This morning I received the OTA update to 2.1 and now all the fonts in my app are REALLY tiny and unreadable. My app looks fine in the 2.1 emulator, so I'm not sure what the problem is. Does anyone know anything about this problem? I'd appreciate it if people would try my app on the following phones and let me know if the fonts are OK.
View 4 Replies
View Related
Jul 1, 2010
Try a game I've released on an Evo? A user has reported that the controls are the wrong way round on the device. Like most arrogant developers :) I initially thought "dumb user error", but I suppose it *might* draw with the Y axis reversed.
The game is Pocket Racing Lite. Touching the left side of the screen should turn the car anti-clockwise, and the right side - clockwise.
View 3 Replies
View Related
Mar 22, 2010
Here is what I got while running a test case of open core . *************** # pvplayer_ engine _test -test 1 1 SDK Labeled: PVDEV_ CORE_RELEASE_6.506.4.1 built on 20090312 Test Program for pvPlayer engine class. Input file name 'test.mp4' Test case range 1 to 1 Compressed output Video(No) Audio(No)Log level 8; Log node 0 Log Text 0 Log Mem 0 Starting Test 1: Open-Play-Stop-Reset Results for Test Case 1: Successes 1, Failures 1 Total Execution time for file test.mp4 is : 2.712000 seconds# *************** I want to ask why it shows 1 success and 1 failure . there should be only 1 pass or 1 fail only . Do each test case have multiple sub-tests within them ? which class in source code finally decide whether it is pass or faiL?
View 2 Replies
View Related
Oct 2, 2009
I am trying to determine if I should go the ndk way to work on a music synth app, but first wanted to do a sanity check in the java layer by testing how many sine tones i could play concurrently, and so I tried this. And it's pretty low: I can only play about 4 or 5 tones before the obtainBuffer timeouts start increasing in number. Also, changing the media volume while the tones are playing disrupts the output.
View 3 Replies
View Related
Jun 25, 2010
Like the Eclipse has a nice graphics integration runner for Android Test project, which does show how tests have run and what the errors or.. is there a built in (which runs with in Android simulator) test runner or any open source version of test ruuners pl.
Command Line version which runs though ADB is horrible.. had to search to even to figure out how many tests have run and what their fate is :)
View 2 Replies
View Related