我想获取有关如何从textView

时间:2016-07-07 18:29:07

标签: android textview httprequest read-data

我正在构建一个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); 

以下是将数据设置到其他活动

上的相应textView的代码
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 REQUEST发送到链接,我无法理解如何解决这个问题

0 个答案:

没有答案