I am looking for a solution in Eclipse. I have a main menu with 5 buttons which I plan on linking with another 5 .xml Layout but I do not know much on programming and Eclipse.
In which files I should add code that will take me from main.xml layout to another with a button click.
I head read previous post with similar topic but the answer does not say were exactly to allocate the code.
Try this code.
[1] call startActivity to open another layout.
startActivity(new Intent(getApplicationContext(), _second.class));
[2] Create another XML layout file which you want to display.
[3] Create new class and give it the name like "_second.java"
public class _second extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.second);
}`
}
That's it.
I understand the point 2 and 3 and how to do it but in which file exactly do I have to put the 1st section of code? startActivity(new Intent(getApplicationContext(), _second.class));
For all answers I kindly thank you.
No comments:
Post a Comment