如何在android中将字符串数组转换为二维字符串数组

时间:2014-04-28 07:48:13

标签: android android-intent multidimensional-array

my activity needs to send a 2 dimensional array to next activity

i am succesfully fetching my data in next activity but it is to be in 2 dimensional format due to some reason 
so how can i convert this data into 2 dimensional format in next activity

in brief i am getting my data but not able to arrange it in 2 dimensional format
curDts = new String[][] {
                {"26","8"},
                {"27"},
                {},
                {"13"},
                {},
                {},
                {},
                {"15","18"},
                {},
                {"2"},
                {},
                {}
        };
in first activity i am doing this to send data
 StringBuilder sb = new StringBuilder();
        String lineSeperator = System.getProperty("line.separator");

        for(String[] row:curDts)
            sb.append(Arrays.toString(row)).append(",");

        String text = sb.toString();

        Intent intent = new Intent(this, AlarmReceiver.class);
        intent.putExtra("key",text);
        sendBroadcast(intent);

2nd activity

Bundle b = arg1.getExtras();
    String[] curdts = b.getStringArray("key");
        Log.v("chking the intent",""+curdts);

0 个答案:

没有答案