public class activityresult2 extends Activity {
static public String txtOrder ="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activityresult2);
Bundle bundle = getIntent().getExtras();
String strfnq = bundle.getString("Noodle quantity");
String strfrq = bundle.getString("Rice quantity");
String strfsq = bundle.getString("Fish quantity");
String stricq = bundle.getString("Iced tea");
Integer strsum = bundle.getInt("sum");
boolean addNingc = bundle.getBoolean("ANI");
boolean addRingc = bundle.getBoolean("ARI");
boolean addFingc = bundle.getBoolean("AFI");
boolean addTingc = bundle.getBoolean("AIT");
boolean addmoneyc = bundle.getBoolean("AMY");
Intent mIntent = getIntent();
int sum = mIntent.getIntExtra("sum",strsum);
TextView costtext = (TextView)findViewById(R.id.costtext);
costtext.setText(String.valueOf(sum));
TextView foodorders = (TextView) findViewById(R.id.foodordershow);
foodorders.setText(getIntent().getExtras().getString("Quantity"));
String addNdlThing = "";
if (addNingc) {
addNdlThing = " with addition of ingredients";
}
String addRlThing = "";
if (addRingc) {
addRlThing = " with addition of ingredients";
}
String addSlThing = "";
if (addFingc) {
addSlThing = " with addition of ingredients";
}
String addTeac = "";
if (addTingc) {
addTeac = " with addition of ingredients";
}
foodorders = (TextView) findViewById(R.id.foodordershow);
if(strfnq.equals("") && strfrq.equals("") && strfsq.equals("")&& stricq.equals("")){
txtOrder = "Sorry, You've not ordered any thing , please return to previous menu to order";
}else if (!strfnq.equals("") && !strfrq.equals("") && !strfsq.equals("")&& stricq.equals("")) {
txtOrder = "Thank you , You've ordered\n" + strfnq + " fried noodle" + addNdlThing +" and\n"+ strfrq
+ " fried rice" + addRlThing +" and\n" + strfsq + " Steam fish " + addSlThing + "and\n" + stricq + " Steam fish " + addTeac;
} else {
txtOrder = "Thank you , You've ordered\n";
if(!strfnq.equals("")){
txtOrder = txtOrder + strfnq + " fried noodle" + addNdlThing;
}
if(!strfrq.equals("")){
txtOrder = txtOrder + strfrq + " fried rice" + addRlThing;
}
if(!strfsq.equals("")){
txtOrder = txtOrder + strfsq + " Steam fish" + addSlThing;
}
if(!stricq.equals("")){
txtOrder = txtOrder + stricq + " Iced Tea"+ addTeac;
}
}
foodorders.setText(txtOrder);
}
後,我在前面的頁面是activityresult1選擇我的食物,我的食物的TextViewfoodorders顯示在這個頁面(activityresult2),下...如果我按下此頁面上的一個按鈕,我想所有的項目顯示在foododers存儲在我的wampserver數據庫是MySQL數據庫,做任何人都知道該怎麼做如何將數據存儲在wampserver
使用Android SDK中您無法連接MySQL服務器。您必須創建服務器端腳本來管理將數據存儲在mysql數據庫中。您可以使用http連接將數據發送到腳本。 – USKMobility
@USKMobility,你知道該怎麼做,如果是的話,請給我發電子郵件至[email protected] – Vyshunavi
等待等待。你想數據庫必須在互聯網上或只是在android應用程序內? Android有SQLite用於存儲食品訂單,僅適用於設備上的數據。如果你想連接到在線數據庫,它會更棘手,但你可以用WAMP建立一個網站,並用android中的httpurlconnect解析數據。 –