Android use of an string array on another method

Posted by spagi on Stack Overflow See other posts from Stack Overflow or by spagi
Published on 2010-05-11T14:05:45Z Indexed on 2010/05/11 17:04 UTC
Read the original article Hit count: 194

Filed under:
|
|

Hi all. Im trying to make an activity that has a multiple choice dialog after you push a button. In there you select from a list of things. But these things are received from a web method before the dialog appears.

So I create a string array after I receive them inside the onCreate to initialise it there with the correct size. But my dialog method then cant get the array because propably its out of its scope. My code looks like this

@Override
 protected Dialog onCreateDialog(int id)
//Here is where the array is loaded to the multiple select dialog
etc


@Override
public void onCreate(Bundle savedInstanceState)
//Here is where i initialise the array and get its contents
etc

I cant initialise my array when the class starts because I dont know its size yet. This has to do something with the scopes of my variables and I am pretty confused

© Stack Overflow or respective owner

Related posts about android

Related posts about array