Question

I have a Android app that will be reading in a asp.net webservice method called getFuelStops() from a predesignated web URL. Below is the contents of the webservice call to getFuelStops().

Webservice results of getFuelStops()

<FuelStop>
      <Physical_Address_Street>3100 Church</Physical_Address_Street>
      <Physical_Address_Local> Chesapeake</Physical_Address_Local>
      <Physical_Address_State>VA</Physical_Address_State>
      <Physical_Address_Zip>23321</Physical_Address_Zip>
      <Phone_Number>555-555-5555</Phone_Number></FuelStop>
<FuelStop>
<FuelStop>
<Physical_Address_Street>3102 Church</Physical_Address_Street>
      <Physical_Address_Local> Chesapeake</Physical_Address_Local>
      <Physical_Address_State>VA</Physical_Address_State>
      <Physical_Address_Zip>23321</Physical_Address_Zip>
      <Phone_Number>555-555-5555</Phone_Number></FuelStop>
<FuelStop>
<FuelStop>
      <Physical_Address_Street>3103 Church</Physical_Address_Street>
      <Physical_Address_Local> Chesapeake</Physical_Address_Local>
      <Physical_Address_State>VA</Physical_Address_State>
      <Physical_Address_Zip>23321</Physical_Address_Zip>
      <Phone_Number>555-555-5555</Phone_Number>
</FuelStop>

Then I have a Activity in my Android app. And displayed as a TableLayout.
I need this activity to read in the list of address's above as a list. For the Address I need the Physical_Address_Street, Physcial_Address_Local, Physcial_Address_State, and Physcial_Address_Zip all concatenated together with a string builder, and the phone as a separate string. My first question is can I do this with KSOAP2 as far as reading this in or do I have to use a RESTFul reader for this? And how would I do this as far as examples.

FuelStopActivity.java

public class FuelStopActivity extends Activity {

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @SuppressLint("InlinedApi")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fuel_stop);
        displayFuleStopTable();
    }


    private void displayFuleStopTable(){
        List<FuelStops> subwayList = new ArrayList<FuelStops>();

        ScrollView sv = new ScrollView(this);

        TableLayout ll = (TableLayout) findViewById(R.id.TableLayout01);

        HorizontalScrollView hsv = new HorizontalScrollView(this);

    }
}
Was it helpful?

Solution

If you are going to a URL and it's spitting out that data, that's probably a RESTful service. RESTful services use HTTP for transport. Therefore, you will want to use something like HttpClient to access this service from your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top