TMA-1
TMA-1

Reputation: 84

Passing a string to a onItemClick-function

I have a listview and when you click an item in the list I repopulate the list with some other data. The problem I have is to pass a string inside a onItemClick so I can use it there. How can I do that?

    private void asdf(int myInt, String myString) {

                Bla bla bla bla...

                //I can access myString here

                OnItemClickListener itemListener = new OnItemClickListener(){

                public void onItemClick(AdapterView<?> parent, View arg1, int position,
                                    long arg3) {

                //But how can I access myString here like the row below
                asdf(Integer.valueOf(aIdList.get(position).toString()),myString);             
                  }

                }
            }

Upvotes: 0

Views: 264

Answers (1)

denis.solonenko
denis.solonenko

Reputation: 11775

You have to declare myString as final to access it in the inner class

Upvotes: 1

Related Questions