How to make variable in method global?
<p>For example I have a method like this. If you see the String 'tablenumber' I want to be able to use it in a later function such as a onclick button so I can send the contents of it to a different activity. But if I use this variable outside the method it's not recognised. How do I go about this.</p>

<pre><code>{
            public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                    int arg2, long arg3) {

                String tablenumber = (String) arg0.getSelectedItem();

            }

            public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
            }
        });
</code></pre>
