blackdog
blackdog

Reputation: 2107

How to start another Activity with android-annotation?

I'm just trying to use android-annotation. When I start another Activity, an empty activity showed up.
I check this to find that the @EActivity generate the subclass of XXActivity named XXActivity_. So I try to code
mIntent = new Intent(this, XXActivity_.class);
But eclipse shows error that XXActivity_ cannot be resolved to a type. I don't know when the XX_ is generated.
I have add the jar, declare the XX_ in the AndroidManifest.xml. How to make eclipse generate the XX_ class?

enter image description here


enter image description here


enter image description here

Upvotes: 0

Views: 1452

Answers (1)

mhemdan
mhemdan

Reputation: 111

you could start activity using annotations like this first you should write your activities on the manifest file with '_' after that you have two activities you want to go from one to another you could use this :

CarDetailActivity_.intent(CarSaleListActivity.this).start();

with this you will go the CarDetailActivity on the other hand if you want to pass message to the other activity you will use this

CarDetailActivity_.intent(CarSaleListActivity.this).myMessage("arrived with android annotations").start();

and in this case you should define this on the CarDetailActivity

@Extra
String myMessage;

and you could use this message on CarDetailActivity like this on

@AfterViews
public void showMessage(){
    Toast.makeText(this,myMessage,Toast.LENGTH_SHORT).show();

} Note : CarDetailActivity should be @EActivity to make this work

Blockquote

Upvotes: 4

Related Questions