Recently, I feel like wanna playing around with the android programming, it had been almost a year since I last read the android programming code. It is a Java based programming, but got to admit, it is quite a pain in the ass. For an instance, even though I attended a 5 days android training last year, I noticed that, during the training, we literally do-all-the-things with a single page. We were taught to use the TextView, ListView, creating an animation, a game, even SQL query, several classes were created, but at the end of the day, all the outcome shows only in a single page. I never wonder how to create another page! At that time, I wasnt realize about that because I was excited to see those outcomes I guess.
And now, I am having an android phone, with some experiences playing with applications, I realized almost all the applications come with several pages, and I started to question myself, ermm, how to create another page? Well, I guess the idea of creating a second page is just similar with the conventional Java programming, but how?
I started google-ing, and I finally found the solution from a thread, where someone asked the same question.
If you want another "screen":
1. create a new layout in /res/layout (e.g. myLayout.xml)
2. create a new class that extends Activity (e.g. MyActivity)
3. in the onCreate of MyActivity add setContentView(R.layout.myLayout);
4. in AndroidManifest.xml inside the application node add (NB: there is a full-stop before the class name)
5. in the onClick of your button in your original activity (the one that calls setContentView(R.layout.main); and has the button) call startActivity(new Intent(this, MyActivity.class));
1. create a new layout in /res/layout (e.g. myLayout.xml)
2. create a new class that extends Activity (e.g. MyActivity)
3. in the onCreate of MyActivity add setContentView(R.layout.myLayout);
4. in AndroidManifest.xml inside the application node add
5. in the onClick of your button in your original activity (the one that calls setContentView(R.layout.main); and has the button) call startActivity(new Intent(this, MyActivity.class));
And this works for me! I am able to create a new screen with these steps now!