you get an Object array, and in there are different types?
If you have the option, I'd say re-write it to return something other than an Object array.
If you are stuck with it, will the structure EVER change? Can you be sure that element 4 (or whatever) will ALWAYS be your blogid? you could hardcode it so that you set each element to a correct reference:
String myBlogID = objectArray;
Note - please try and be precise when explaining the problem. There no such thing as a 'string' in java (unless you wrote that class yourself). There is a String class. these details are important.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Sep 18, 2010
This is my actual code and it works fine..
I get object in return . but i don,t know how to retrieve values from it..
for example i want to print the blogName.
see this link for the structure of the object returned..
Well an Object can be anything, including an Object (an Object cannot be cast to an Object though).
In your case, the variable result was declared of type Object, and so you could skip the casting in this line:
Object result = client.execute("wp.getUsersBlogs", params);
And then, after you stored the result of client.execute in a variable which can store any type, you're like, ok I know that the Object is actually an Object so do this:
Object resultProper = (Object)result;
But you could have just as easily done this:
Object result = (Object) client.execute("wp.getUsersBlogs", params);
I do'nt get why the array should be casted to an object array??
Get it now? There was no array to cast to an object array as far as the compiler is concerned (even though YOU knew the Object result had an Object, the compiler only knew that the variable result was of type Object and therefore could hold any type).
Then, since YOU knew that it actually is an Object, you told the compiler "hey, that Object is actually an Object", and you did this by casting.