FAQ Database Discussion Community


Sending images with AndroidAnnotations RestService

android,spring,android-annotations
What is the best way to send a file using the RestService? I have an image that I have to send to the server. The API expects the following POST data: image -> image I want to send description -> text title -> text Can I just send an object...

Android annotations not injecting RestService

android,android-annotations
Hi I can't inject the RestService anywhere in my code. I'm working test driven so I am using Robolectric to test this code. I hope it isn't a problem with AA+Robolectric, I don't have any experience with this. The weird thing is that in my tests I can manually insert...

Android annotations access singleton class object into other class static method

android,android-annotations
From MyActivity , call to : 1. MyClass.getInstance(); 2. MyClass.doStuff(); @EBean(scope = EBean.Scope.Singleton) public class MyClass { @Bean MyManager manager; public static void doStuff(){ manager.show(); // null pointer exception for the manager why ? how to access it ? } public static MyClass getInstance() { if (_instance == null) {...

AndroidAnnotations and EventBus

android,android-annotations,greenrobot-eventbus
I have an annotated Activity in a library, which is a subscriber to an EventBus event from the same library. It looks something like this, greatly simplified: @EActivity(resName = "activity_foo") public class Foo extends Activity { public void onEvent(BarEvent event){ doSomething(); } } It should work according to this: http://timnew.me/blog/2014/09/14/otto-and-android-annotations-compatibility-issue-analysis/...

Android Studio with AndroidAnnotations NoClassDefFoundError

java,android,android-studio,android-gradle,android-annotations
I have an app with Android annotations that is giving me a NoClassDefFoundError when I try to run it. java.lang.NoClassDefFoundError: br.socialcondo.app.rest.services.UserService_ In the annotations log I can see that this class is generated: Note: Generating class: br.socialcondo.app.rest.services.UserService_ What I am doing wrong here? EDIT Sharing build.gradle buildscript { repositories {...

android annotations @background NetworkOnMainThreadException

java,android,android-annotations,networkonmainthread
Why I get this error? Shouldn't android annotations take care of threading? Any help will be appreciated :). Thank you @EActivity(R.layout.activity_main) public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); tradingHistory(); } void myMethod() { tradingHistory(); } @Background void tradingHistory (){ Helper helper = new Helper();...

Generate bitmap from view

android,bitmap,android-annotations
When I get the bitmap from the DrawingCache of a view I get no error but I don't see a valid bitmap either. What am I doing wrong? The code I use to generate the bitmap: SharePhotoView sharePhotoView = SharePhotoView_.build(this); sharePhotoView.bind(mCatch); sharePhotoView.setDrawingCacheEnabled(true); sharePhotoView.buildDrawingCache(); Bitmap bitmap = sharePhotoView.getDrawingCache(); catchImage.setImageBitmap(bitmap); The code...

Multiple dex files define Lorg/springframework/http/ContentCodingType$1

rest,android-annotations,spring-android
I test androidannotations framework, but have some error when I add spring-android libs. I create repo for my test project open_git_repo ! At this moment, I have in gradle console AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position": {},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"} AGPBI: {"kind":"SIMPLE","text":"com.android.dex.DexException: Multiple dex files define Lorg/springframework/http/ContentCodingType$1;","position{},"original":"com.android.dex.DexException: Multiple dex files define...

Do Dagger 2 and Android Annotations work together?

android,android-annotations,dagger-2
I've read here that Android Annotations has been updated to work with Dagger (1), but I am not sure if it automatically applies to Dagger 2 as well. Does anybody use AA and Dagger 2 together? Thanks....

Android annotations and flavors in Android Studio 1.0.1

android,android-studio,android-annotations,android-productflavors
i'm trying to add two flavors in my project, I already have android annotations and it's working fine without the favors, but when I'm adding the two favors the MainActivity_ class is generated only for one of the flavors when changeing the build variant. Any ideas on how could you...

AndroidAnnotations bean initialize when OnActivityResult called

java,android,onactivityresult,android-annotations
EDIT This problem is due to ViewPager+TabInfo UI structure, which child fragments are re-instanciated when AddTab performed. I post a reply accordingly. ORIGINAL POST BELOW In below code, the bean injectedListAdapter is not initialized(null) but also @AfterInject and @AfterView are not executed when @OnActivityResult is invoked. For that, 1. How...

AndroidAnnotation REST handling calbacks

java,android,rest,android-annotations
I'm working on android application using AndroidAnnotation. The app make REST calls to my remote API. So i setup AA and my REST client. But i want to write generic code for handling response datas. I got a RestClient class where the @Rest annotation is defined a RestCall class where...

AndroidAnnotations. button click inside actionLayout of menuItem

android,appcompat,android-menu,android-annotations
In AA+AppCompat, I try to change below code in Activity to AA-style. @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_done, menu); MenuItem menuItem = menu.findItem(R.id.itemDone); View menuView = MenuItemCompat.getActionView(menuItem); mButtonQuestionPost = (Button) menuView.findViewById(R.id.buttonMenuDone); mButtonQuestionPost.setOnClickListener(this); return super.onCreateOptionsMenu(menu); } First, changed head of Activity as below. The menu was...

AndroidAnnotations Rest view response data

android,spring,android-annotations
I am doing an API call using the Android Annotations RestService. The only problem is that I receive a JSON but I don't know how to see that JSON string. Is there a way I can view the response data so I can see the JSON string/content? I tried using...

Otto. Avoid @Produce validation warnimg message

android,android-annotations,otto
Android Otto library gives below warning message when @Produce method is used. How to avoid the message? Note: Validating elements C:\Users\Me\GroupViewActivity_.java:90: warning: Element ProduceHandler unvalidated by public GroupViewEvent produceGroup() { ^ C:\Users\Me\GroupInfoFragment_.java:111: warning: Element SubscribeHandler unvalidated by public void onUpdateGroup(final GroupViewEvent event) { I use otto in order to communicate...