ParcelerIntegration - WonderCsabo/androidannotations GitHub Wiki
Integrating Parceler and AndroidAnnotations
Since AndroidAnnotations 4.0.0
Parceler is an annotation processor which generates implementation of the Parcelable
interface, thus removes tons of boilerplate code.
AndroidAnnotations can detect if Parceler is on the classpath, and automatically call it during various Bundle
operations. You just have to annotate your POJO with Parceler annotations as usual, and pass the simple object around: AndroidAnnotations will call Parcels.wrap/unwrap
when needed.
Usage example:
@Parcel
public class Person {
String name;
int age;
public Person() {
}
@ParcelConstructor
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
}
@EActivity
public class ExtraInjectedActivity extends Activity {
@Extra("personExtra")
Person person;
@AfterInject
void afterInject() {
Log.w("AAParceler", person.getName());
}
}
Person john = new Person("John Doe", 25);
ExtraInjectedActivity_.intent(context).personExtra(john).start();