Question

I have login- and game-layout in my activity. I would use AndroidAnnotations in my project, because that is cool! but I don't know, how to change correctly the login-layout to game-layout.

Initialization of login-layout I would do with the annotation:

@EActivity(R.layout.login)
public class MyActivity extends Activity {

May be that is a failure approche to change the layouts inside of activity? What is the clean way?

Was it helpful?

Solution

No... this is how android annotations is expected to be used. You don't have a syntax error, if that's what you are asking.

There's not much more I can do than to direct you to the installation page, which can be found below.

Eclipse Project Configuration


Just use two separate Activitys for the login and game. When the user logs in, you will launch the new Game activity with,

startActivity(this, GameActivity.class);

This is far preferred to remaining into the current activity and simply swapping the layouts in and out. An activity is supposed to be focused on a particular aspect that you are trying to achieve. The game and login are completely different in their functionality, so it definitely makes sense to separate their functionality into separate activitys.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top