i need to convert a base64 value into string array so simply i have write this :
String s[] = new String[partyname.length];
for(int i=0;i<=partyname.length;i++)
{
byte[] bytes = Base64.decode(partyname[i], Base64.DEFAULT);
String string = new String(bytes, "UTF-8");
s[i] = string;
System.out.println("string is ::" + string+s[i]);
}
but i dont know why it raise null pointer error at s[i] = string; line if i remove it then working fine so please help me out.
You need to create your String array that s references first. You have
So when you try to use s such as
Then there s is still null, and trying to get the i element of s gives you the null pointer.
From the rest of the code I think you want a String array with the same number of elements as party name, so you need