-1

In my code i want to pass string array to the function.I need to know how to convert string values to the string array?I have string values which are dynamically got and then want to pass it as string to another function.

Here is my code!

 Intent in = getIntent();

   medname= in.getExtras().getString("mymedname");
   mediname=???????

   adapter = new MedicationsAdapter(this,mediname);

Any suggestion will be appreciated!

Uday
  • 21
  • 10
  • 1
    Do you have any delimiter for that string (like comma, space etc)? – Pradeep Simha Oct 24 '13 at 11:05
  • Your question is not understandable? ... What is medname tpye ? – Makky Oct 24 '13 at 11:05
  • Do you want the contents of `medname` split by some delimiter, or do you want to pass all of it in the content of a length 1 array? – kiheru Oct 24 '13 at 11:08
  • http://stackoverflow.com/questions/3413586/string-to-string-array-conversion-in-java/3413608#3413608 – VAr Oct 24 '13 at 11:08
  • I am trying this code for android application.I received a string value(medname) from one intent now i want to store this value in string array here mediname[] then it could be passed to adapter class.This was i want? – Uday Oct 24 '13 at 11:13
  • Sounds like the latter case then, if I understood you right. Take a look at @YousufUmar's answer. That creates an array `{ "name" }`. – kiheru Oct 24 '13 at 11:20

1 Answers1

-1

mediname = medname.split(" ");

Alex Suo
  • 2,977
  • 1
  • 14
  • 22
  • you cant store splited string into a string object. It requires sting array object – AJ. Oct 24 '13 at 11:15
  • here mediname is string array i declared it as string mediname[];in my code.Is it correct? – Uday Oct 24 '13 at 11:17