February 7th, 2012, 09:51 PM
|
#1 (permalink)
|
|
New Member
Join Date: Feb 2012
Posts: 3
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
|
Help needed switching activities
I have a lab (project) that I need done for school in order to know how to do the first assignment. The lab introduces both changing activities and passing variables from one activity to another.
The second part of that, I understand how to do... I think... I just don't know how to change from one activity to the next.
The overview of the project is here: CSCI 153 Lab
Uploaded is the code that I'm working with. I've already taken advantage of the search feature of the forum, but found nothing that truly helps.
To cut to the chase, here's the code that I have regarding the button-press to change the activity
Code:
public void submit(View v){
String orientation = editO.getText().toString();
String item1 = edit1.getText().toString();
String item2 = edit2.getText().toString();
String item3 = edit3.getText().toString();
Intent intent = null;
if(orientation.equals("H")){
intent = new Intent (this, Horizontal.class);
}
if(orientation.equals("V")){
intent = new Intent (this, Vertical.class);
}
intent.putExtra("Text1",item1);
edit1.setText(orientation);
intent.putExtra("Text2",item2);
intent.putExtra("Text3",item3);
startActivity(intent);
}
|
|
|