我正在构建一个 android 应用程序我想获取信息如何从 textView 读取数据并发送一个 http 请求我无法弄清楚要做什么才能使它工作。
以下是我在意图部分中使用的代码,它将从编辑文本中获取数据。
Intent summeryPage = new Intent(Form_section.this ,summry_page.class);
// ((routernBoltBeam)this.getApplication()).setFirstName(FirstName);
summeryPage.putExtra("fname",fName.getText().toString());
summeryPage.putExtra("lname",lName.getText().toString());
summeryPage.putExtra("date",date.getText().toString());
summeryPage.putExtra("email",emailAddress.getText().toString());
summeryPage.putExtra("mobuleNumber",mobileNumner.getText().toString());
summeryPage.putExtra("adults",adultsNumber.getText().toString());
summeryPage.putExtra("totalChildren",childensNumber.getText().toString());
summeryPage.putExtra("childAge",childrensage.getText().toString());
summeryPage.putExtra("hotelRooms",numberOfhotelRooms.getText().toString());
summeryPage.putExtra("departureCity",departureCity.getText().toString());
summeryPage.putExtra("destination",yourDesiredDestination.getText().toString());
summeryPage.putExtra("days",numberOfDays.getText().toString());
summeryPage.putExtra("Budget",yourBudget.getText().toString());
summeryPage.putExtra("selectHotel",preferHotel);
summeryPage.putExtra("airtickets",airticketPrefer);
summeryPage.putExtra("intercity",vehiclePreferance);
summeryPage.putExtra("travelType",travelPreferances);
summeryPage.putExtra("mealPlan",mealPreferances);
summeryPage.putExtra("addInfo",additionalInformation.getText().toString());
startActivity(summeryPage);
以下是将数据设置到其他活动的相应文本视图中的代码
public void showData(){
nameText =(TextView)findViewById(R.id.content);
viewDateText =(TextView)findViewById(R.id.showDate);
viewEmailText=(TextView)findViewById(R.id.showEmail);
viewMobileText=(TextView)findViewById(R.id.showMobileNumber);
viewTotalAdultText = (TextView)findViewById(R.id.showTotalAdults);
ViewTotalChildren =(TextView)findViewById(R.id.showTotalChildrens);
viewChildAge =(TextView)findViewById(R.id.showChildrensAge);
viewTotalRoomsText =(TextView)findViewById(R.id.showTotalRooms);
viewDepartureText =(TextView)findViewById(R.id.showDepartureCity);
viewDeatinationText =(TextView)findViewById(R.id.showDestination);
viewDaysText =(TextView)findViewById(R.id.showTotalDays);
viewBudgetText =(TextView)findViewById(R.id.showBudget);
viewPreferHotelText =(TextView)findViewById(R.id.showHotelPreferance);
viewAirticketText =(TextView)findViewById(R.id.showAirticketRequired);
viewIntercityText = (TextView)findViewById(R.id.showIntercityTravel);
viewTravelTypeText = (TextView)findViewById(R.id.showTraveType);
viewMealText =(TextView)findViewById(R.id.showMealPlan);
viewInfoText = (TextView)findViewById(R.id.showAdditionalInfo);
//String s =((routernBoltBeam)this.getApplication()).getFirstName();
Intent summery = getIntent();
String fName = summery.getStringExtra("fname");
String lName = summery.getStringExtra("lname");
String Date = summery.getStringExtra("date");
String Email = summery.getStringExtra("email");
String Mobile = summery.getStringExtra("mobuleNumber");
String totalAdults = summery.getStringExtra("adults");
String totalChildrens = summery.getStringExtra("totalChildren");
String ChildresnAge = summery.getStringExtra("childAge");
String TotalRooms = summery.getStringExtra("hotelRooms");
String Departure = summery.getStringExtra("departureCity");
String Destination = summery.getStringExtra("destination");
String TotalDays = summery.getStringExtra("days");
String TotalBudget = summery.getStringExtra("Budget");
String PreferHotel = summery.getStringExtra("selectHotel");
String SelectAirticket = summery.getStringExtra("airtickets");
String InterCityText = summery.getStringExtra("intercity");
String travelType= summery.getStringExtra("travelType");
String MealPlan = summery.getStringExtra("mealPlan");
String AddInfo = summery.getStringExtra("addInfo");
nameText.setText(fName +" "+lName);
viewDateText.setText(Date);
viewEmailText.setText(Email);
viewMobileText.setText(Mobile);
viewTotalAdultText.setText(totalAdults);
ViewTotalChildren.setText(totalChildrens);
viewChildAge.setText(ChildresnAge);
viewTotalRoomsText.setText(TotalRooms);
viewDepartureText.setText(Departure);
viewDeatinationText.setText(Destination);
viewDaysText.setText(TotalDays);
viewBudgetText.setText(TotalBudget);
viewPreferHotelText.setText(PreferHotel);
viewAirticketText.setText(SelectAirticket);
viewIntercityText.setText(InterCityText);
viewTravelTypeText.setText(travelType);
viewMealText.setText(MealPlan);
viewInfoText.setText(AddInfo);
}
所以现在我想做的是从这些 TEXTVIEWS 中读取数据并将 HTTP 请求发送到链接,我无法理解如何弄清楚