When I start an activity such solo.click(sth),
and then I am in a new activity. But when I run solo.getCurrentActivity(), the returning message is not the current one actually. It's the former one.
However, when I enter solo.getview(blablabla), and then run solo.getCurrentActivity(), it works again. I guess this is the waiting problem but I just don't know how to solve it. I've tried waitForActivity() and something similar but it doesn't work very well.
Do any one have suggestion?
Finally after several days I have found the answer. The solo.getCurrentActivity(yourAct,time) works. It's much safer than before now.
Related
Last week I updated the SDKs and I had some problems, so I downloaded a new version of Eclipse. But then somethings started to happen.
For example, I had some projects that I picked a double from a EditText using
Double d = Double.parseDouble(v1.getText().toString());
Now, this isn't working anymore. Every time I try to do this, there is a NumberFormatException, but I believe the problem isn't in the conversion, cause I'm doing the exactly same thing I used to do in other projects.
I can't even display datas in TextViews. I'm not sure what's going on here. I'm new to this and I don't undestand too much about Android/Eclipse/Java, but I'm sure that there isn't anything wrong in the project, because I'm doing the same thing that used to work until last week.
Actually, when I saw it wasn't working I tried to download the same version I had, but this errors continued to happen. I guess the problem is in my pc, but I would like to know if it has already happened with anyone.
If someone know what's going on, please answer this!
Thank you, guys.
Ive got a strange issue that has me beating my head into a brick wall. In my android app I have a method that checks the mobile state and depending on the outcome pulls an image from on line. I started to receive java.lang.NullPointerException in the developer console. It was being caused by there being no mobile state to check. Simple enough and was fixed with an if statement.
This method was in several activity's and the fix was applied to all. For some reason I am still receiving errors in the console but only for one of the activity's. The error message is the same as last time, and Ive been through the code a million times it shouldn't be doing it has the same fix as the other activity's. Also I cannot re create the error, which is making it impossible to fix. As far as I can see its not broke.
Any suggestions of what to do in this situation? Would a try and catch be appropriate?
Try cleaning (in eclipse, Project -> Clean...) your project. I find this sometimes fixes issues with the app seamingly not being updated when changes are made to the source...whether the source being a resource or source code.
Perhaps check if there are any contexts not clearly defined. Or if you simply wrote one of "(this)", try being more explicit: "(mainactivity.this)"
My app started to get really slow between activities and I started to investigate
from the time I run StartActivty until onCreate in that activity start, can take up to 1000ms
Can anyone tell me what this could be
I tried to remove everything in oncreate and it's not it.. it's simply the 800ms to 1000ms before it even runs onCreate
The reason could be hidden in your xml layout files. Xml parsing itself is resource consuming. So check them out.
If you are running the application in 4.x device. Please the Setting -> Developer Option-> Don't Keep Activites enabled or not.
If it's enabled your application might be slow.
Please check out the option.
I am using Eclipse w/ ADT. I am creating the HelloTabWidget app from http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
When I go to run the app in the emulator it throws an error somewhere in TabHost.addTab(TabSpec), but I am not able to discover what is wrong. I tried to step thru, but there is so much going on inside that call that it takes a long time and I have yet to find out what is wrong.
Does anyone have any recommendations on a better way to debug and find the root cause?
What I figured out is that I can put a try/catch around the call to TabHost.addTab(TabSpec). When I do the catch I call an AlertBox as described http://androidideasblog.blogspot.com/2010/02/how-to-add-messagebox-in-android.html
I'm new in android testing. All I've used in the testing is only the ActivityInstrumentationTestCase2 (AITC2) which is explained in the Hello, Testing tutorial.
I've made a test class using AITC2 and it runs well. But once I changed the base test class to SingleLaunchActivityTestCase (SLATC) I got RuntimeException specifying "Unable to resolve intent.. blabla.." which I suspect was originated from launchActivity().
I thought AITC2 and SLATC are pretty much the same, besides that in SLATC the activity being tested only launched once (setUp() only launched once for all test cases) and in AITC2 the activity will be launced for every test cases.
I've tried to find some example or documentation about how to use SLATC but still no luck.. :(.
Anybody knows why the activity cannot be launched in SLATC? Thanks in advance :)
Solved it. I put a wrong package string in the constructor because I have several different subpackages in my project.
I put [package].activity, it should be only [package].
Kind of weird answering my own question, but just in case someone looking for an answer from the same mistake as mine.