Repository navigation
[edited] @Extra fields should be updated when setIntent() is called #166
Description
Activity
You are perfectly right. That's a bug, we need to fix it :) .
So, I thought Id have a go at this, but following the instructions on https://github.com/excilys/androidannotations/wiki/InstallingEnvironment I didnt manage to get things set up..
Probably the instructions are a little bit outdated, because naming of projects does not really match is seems, amongst other things.
For example have not "rest-api-test-1-5" project, but i do have a functional-test-1-5-tests instead. Is this the same?
Anyway, after a lot of fiddling, i managed to get junit to run tests, but now they fail because R is not found:
java.lang.Error: Unresolved compilation problems: R cannot be resolved to a variable R cannot be resolved to a variable R cannot be resolved to a variable R cannot be resolved to a variable at com.googlecode.androidannotations.test15.TouchesHandledActivity.<init>(TouchesHandledActivity.java:24) at com.googlecode.androidannotations.test15.TouchesHandledActivity_.<init>(TouchesHandledActivity_.java:18) at com.googlecode.androidannotations.test15.TouchesHandledActivityTest.setup(TouchesHandledActivityTest.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at com.xtremelabs.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:206) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)Not build errors reported by eclise,
aa classes are generated fine
android generated files are on classpathany ideas?
Any chance of looking through the instructions with todays code and update it? Im unfortunately not qualified myself at this point to know whats right and wrong here :)You're definitely right : the documentation is not up to date. I have to rewrite them, and that means downloading a new clean eclipse, updating to the last version of all the maven / android / etc plugins, and carefully writing down each step.
I'll try to do that in the coming weeks, because I'd really like to get more contributions :) .
So, you seem to have a "R" not found when running the tests with robolectric. Is the R class actually generated in the first project?
I see, and I understand if its not top priority.
Anyway, I got past the R problem too somehow (probably after messing with classpath, not sure :-P)
Now everything seems fine, except when I run unit tests they freeze.
for example the first one, has in its setup:
public void setup() { activity = new TouchesHandledActivity_(); activity.onCreate(null); mockedEvent = MotionEvent.obtain(0, 0, 0, 0f, 0f, 0); }when TouchesHandledActivity_.onCreate calls its super method, then everything hangs on
setContentView(layout.clickable_widgets);any idea on this one? :)
Tried googling it a bit but didnt find anything that helped :-P/L
I also get warnings like below, is this normal?
Warning: an error occurred while binding shadow class: ShadowBluetoothAdapter
Warning: an error occurred while binding shadow class: ShadowBluetoothDevice
Warning: an error occurred while binding shadow class: ShadowGeoPoint
Warning: an error occurred while binding shadow class: ShadowItemizedOverlay
Warning: an error occurred while binding shadow class: ShadowMapController
Warning: an error occurred while binding shadow class: ShadowMapActivity
Warning: an error occurred while binding shadow class: ShadowMapView
Warning: an error occurred while binding shadow class: ShadowOverlayItem
Warning: an error occurred while binding shadow class: ShadowZoomButtonsController/L
Maybe this is a roboguice issue, it hangs on the sdk-line.. notice the comment
// Should always work from the command line. Often fails in IDEs because they don't pass the full PATH in the environment try { Process process = Runtime.getRuntime().exec(new String[]{"which", "android"}); String sdkPath = new BufferedReader(new InputStreamReader(process.getInputStream())).readLine();sorry for spamming the thread, but after looking at that code it will obviously not work on windows. i will investigate this a bit myself, no need fgor you to waste time right now.
Ok, this was indeed the cause of the freeze.
After examinigng roboguice code a bit, it came clear that setting ANDROID_HOME was sufficient and now my tests run and pass (and apparently made my phone reboot :-)thanks for your patiance
I did not mean to close the issue.
Wow. You seem to progress quite well :) Sorry for not answering any earlier, I'm at a conference those days (Devoxx France).
Running the tests made your phone reboot ? That's quite unexpected. Are you running the tests on your phone ?
No need for appologies, hope youre having a good conference!
Now that i got things to compile and run, im halfway done with a fix of the
original issue. :)/L
On Apr 20, 2012 1:49 PM, "Pierre-Yves Ricau" <
reply@reply.github.com>
wrote:Wow. You seem to progress quite well :) Sorry for not answering any
earlier, I'm at a conference those days (Devoxx France).Running the tests made your phone reboot ? That's quite unexpected. Are
you running the tests on your phone ?
Reply to this email directly or view it on GitHub:
Ok, I sent a pull request, lets hope for the best ;-)
Anyway, I saw this comment on the page that describes setting up dev env:
To see your changes in the code, you have to restart the 2nd eclipse. We didn't find any better solution, but tell us if you do!I just run second eclipse in debug mode, then hot code replace will work and upon changes in code you can just clean the test projects or other projects you have in second eclipse.
I'll have a look at that :) .
You're right regarding the comment, I need to clean up things there :) . Hot code replace works, but only inside methods, if you modify signatures you need to restart it. I should give JRebel a try :) .
This issue was closed by 85da1fc.
We override
setIntent(). If a user wants to reinject the extras, he should overrideonNewIntent()and callsetIntent()from there.Also note that
@Extracan now only be used in Activities.- added a commit that references this issue
on May 10, 2012
Hello
Im using notifications to launch an activity and in this activity I have used the @extra annotation to inject my extras.
Example:
However, my serverView is never updated with new text during the PostResume, unless I also add:
Shouldnt this updating be done automatically be androidannotation?
br