[android-developers] getting a nullpointerexception, anyone see my problem?
My code is below... With this I want to return an array of all the
instances of whatever I'm searching it for.
So say my string is...
mystring = "i like ham, i like chicken, i like carrots,";
and I run...
myarray = dig_all("like ", ",",mystring);
then myarray should consist of 'ham', 'chicken', and 'carrots'
See anything wrong with my code? DDMS says it's a
nullpointerexception. I'm not the swiftest with java. :(
private String[] dig_all(String starter, String ender, String
content)
{
String[] result = null, data, data1;
String data2;
boolean more = true;
int i = 0;
int limit = 0;
do
{
i++;
data = content.split(starter);
data1 = data[i].split(ender);
data2 = data1[0];
if ((data2==null) || (limit>0 && i==limit))
more = false;
else result[i] = data2;
} while (more == true);
return result;
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home