• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Having problem in an array

coder05

Lurker
Hi,
I have a string str and I want to take the string and put it in the int[] xAxis array.How can I do that? The following code is not working, need help.

[HIGH]String str = 12,16,23,78;
String[] nums = str.split(",");

int[] newArr = new int[nums.length];
for(int i = 0;i < newArr.length;i++)
{
newArr = Integer.parseInt(nums);
int results = newArr;
}

int[] xAxis = new int[]{results};
[/HIGH]
 
Shouldn't the following:
Code:
String str = 12,16,23,78;
need to be:
Code:
String str = "12,16,23,78";
 
Back
Top Bottom