2

My web service is returning quite a bit of data, so i'm storing it in an arraylist and returning that to my application. I don't know whether or not this is the preferred method or not. When the arraylist is returned and displayed in my application, it also displays the arraylists "anyType" section. I'm new to this whole process so i'm sure i'm missing something somewhere or going about this incorrectly. Can anyone point me in the right direction please?

2 Answers 2

0

Are the instances of the object in the ArrayList all the same type? If so, then you might want to expose an IEnumerable<T> (where T is of that type) and then regenerate whatever proxies you are using on Android. This will probably give you a strongly-typed list which you can then consume more easily.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, it's returning all string values. Do you have a code snippet for that? If not i'm sure i can find and example on google. Also, do you know if there's anyway to separate each string value?
@benjamin schultz: You just return IEnumerable<string>, which List<string> implements. As for separating each string value, what do you mean?
Sorry if it's confusing! Basically, I have a VB .net ws which calls upon a stored procedure that retrieves string values from my database (string values such as all the states within a country). I loop through and get all the states and store them in an arraylist (i've also been testing substituting arraylist for just a list of strings). Then I return that arra list to my application, and from there i want to bind that to a ListView. ...continuing post on different comment...
I can get so far as to returning my arraylist to my application but when it gets there it contains all the unnecessary anyType{ junk, and i don't recognize that as something i can parse. Would i be better off trying to find another way to do all of this? /long winded explanation Thanks again man for all your help!
0

I have implemented such a thing before. I followed a different approach.

First, I suggest you insert a sort of delimiter like "#" to separate each individual item of your ArrayList. You can refer this for that.

That will help you return a Array of String in the form "item1#item2#item3#"

Now as far as the Android code using ksoap is concerned, have a look at this

In this code, check the soap calling method. I separate the String returned by my webservice using the "#" delimiter and store it in an array for populating a Spinner.

You can do as per what you want.

Hope I helped you.

Cheers

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.