how to merge two apps in adroid java



i have the .xml and .java files of both apps. i want to crete a row of buttons on the left handside that on a click of a button it will take u to some other page.


this is the xml file of app1.



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivitywhatsyourgrade" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="22dp"
android:text="Type in your marks" />

<EditText
android:id="@+id/testscore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView1"
android:ems="10" >

<requestFocus />
</EditText>

<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:ems="10" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/testscore"``
android:layout_centerHorizontal="true"
android:layout_marginTop="68dp"
android:text="what&apos;s my grade" />


and this is the .java file of app1



public class MainActivitywhatsyourgrade extends Activity {
protected static final int A = 0;
Button bt1;
EditText etxt1;
EditText etxt2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_activitywhatsyourgrade);
bt1=(Button)findViewById(R.id.button1);
etxt1=(EditText)findViewById(R.id.testscore);
etxt2=(EditText)findViewById(R.id.editText2);
bt1.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String strScore = etxt1.getText().toString();
int score = Integer.parseInt(strScore);
if (score >=90){
etxt2.setText("A1");
}
else if(score>=80){
etxt2.setText("A2");
}
else if(score>=70){
etxt2.setText("B1");
}
else if(score>=60){
etxt2.setText("B2");
}
else if (score>=50){
etxt2.setText("C1");
}
else if (score>=40){
etxt2.setText("C2");
}
else if (score>=32){
etxt2.setText("D");
}
else if (score>=20){
etxt2.setText("E1");
}
else if (score>=-1){
etxt2.setText("E2");
}

}
});

}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_activitywhatsyourgrade, menu);
return true;


}


}


the second .xml and .java files are the same. just that one is for calss 9 and the other is for calss 10. i want create a list of button on the left handside to take me where i want ether the calss9 xml or class 10 xml.


No comments:

Post a Comment