0

Is there a way to directly convert a "BLOB"-array into a String[][]-array (on Android?

Thanks very much in advance!

6
  • I don't know very much about android, but it's written in Java, yes? So then what you need to do is convert the individual elements of the BLOB array. Commented Jul 8, 2011 at 15:41
  • Yes, it's written in Java. Unfortunately I don't really know how to convert the individual elements of the blob array. Commented Jul 8, 2011 at 15:43
  • Is there a method for each element to convert it to a string array? Commented Jul 8, 2011 at 15:50
  • If an answer has helped you, please choose it as the best answer. Otherwise answer the question with the solution you found and select that as the best answer. Commented Jul 28, 2011 at 14:55
  • I would have, but unfortunately none of the answers really helped me. I solved the issue I had a different way withouth coding blob to String[][]. Commented Jul 28, 2011 at 16:11

3 Answers 3

1

Try this: Converting blob array to string array:

BLOB[] blobs = getBlobs(); //fetch it somehow
String[] strings = new String[blobs.length];
for(int i = 0; i < blobs.length; i++)
    strings[i] = new String(blobs[i].getBytes(0, blobs[i].length());
return strings;

Converting blob array to string matrix:

BLOB[] blobs = getBlobs(); //fetch it somehow
String[][] strings = new String[blobs.length][];
for(int i = 0; i < blobs.length; i++)
    strings[i] = blobToStringArray(blobs[i]);
return strings;
Sign up to request clarification or add additional context in comments.

4 Comments

I thought as much, but what about converting a BLOB to a String[][]-array? How do I know which of the bytes belong to which of the array?
How are you planning on converting it? You would need to represent a BLOB as an array of strings. I'll post an example above.
Thank you for your example, unfortunately "getBlobs" only returns a byte[]-array, not a blob array as the name would suggest. Certain operations are not available with the byte-array
You'll need to find some way to convert a BLOB to a string array. Could you provide some more context on what exactly you're doing?
0

From what I understand, blobs return bytes. So you want to build a byte array and then build the string from that. This is an example.

Hope it gives you a good start.

Comments

0

My solution doesn't require codingBLOBs to String[][]-arrays anymore, now I am (de-)coding SoapEnvelopes to byte-arrays and vice versa using a method described here: http://androiddevblog.blogspot.com/2010/04/serializing-and-parceling-ksoap2.html

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.