java - How to call object from other class to another class and add it? -
java - How to call object from other class to another class and add it? -
i'm new android java coding. i'm seek menu list have tick box, , 1 time tick items, n press next, should go view layout , show items , total of item selected, press next should open details page user must set details n press send button send via email. don't know how phone call items menu cart , confirmation class.
this menu.java .
class="snippet-code-js lang-js prettyprint-override">import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.toast; public class menuactivity extends activity { button btnorder; button btnback; button btnlinkcart; protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.menu); btnlinkcart = (button) findviewbyid(r.id.button1); btnback = (button) findviewbyid(r.id.button2); // button click event btnback.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { intent intent = new intent(menuactivity.this, mainactivity.class); startactivity(intent); } }); // link cart screen btnlinkcart.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { intent = new intent(getapplicationcontext(), viewactivity.class); startactivity(i); finish(); } }); } }
this cart.java
class="snippet-code-js lang-js prettyprint-override">import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class viewactivity extends activity { button btnconfirm; protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.cart); btnconfirm = (button) findviewbyid(r.id.button1); // link cart screen btnconfirm.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { intent = new intent(getapplicationcontext(), confirmactivity.class); startactivity(i); finish(); } }); } }
this cart.xml class="snippet-code-js lang-js prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/wallpaper" > <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:text="confirm" /> </relativelayout>
this menu.xml class="snippet-code-js lang-js prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/wallpaper" android:orientation="vertical" > <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:text="next" /> <button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:text="back" /> <checkbox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_margintop="28dp" android:text="pizza (large) rm30.00" android:textappearance="?android:attr/textappearancelarge" /> <checkbox android:id="@+id/checkbox2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox1" android:layout_margintop="20dp" android:text="pizza (mediume) rm20.00" android:textappearance="?android:attr/textappearancelarge" /> <checkbox android:id="@+id/checkbox3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox2" android:layout_margintop="20dp" android:text="pizza (personal) rm10.00" android:textappearance="?android:attr/textappearancelarge" /> <checkbox android:id="@+id/checkbox4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox3" android:layout_margintop="20dp" android:text="chicken wings rm12.00" android:textappearance="?android:attr/textappearancelarge" /> <checkbox android:id="@+id/checkbox5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox4" android:layout_margintop="19dp" android:text="garlic breadstuff rm6.00" android:textappearance="?android:attr/textappearancelarge" /> <checkbox android:id="@+id/checkbox6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox5" android:layout_margintop="20dp" android:text="soft drink (large) rm5.00" android:textappearance="?android:attr/textappearancelarge" /> <checkbox android:id="@+id/checkbox7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/checkbox6" android:layout_margintop="19dp" android:text="soft drink (medium) rm4.00" android:textappearance="?android:attr/textappearancelarge" /> </relativelayout>
make variable want in menu class static, in cart class can them this:
menu.variablefrommenuclass
java android android-layout android-intent android-activity
Comments
Post a Comment