java - Stack in android -


it's first time me use java need use stack in android funcions if define stack out of function give me error (should parametrized) , application crashes

public class televideo extends activity{     stack pila = new stack();      @override     public void oncreate(bundle savedinstancestate){         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          pila.push(mystring);     }      @override     public boolean onoptionsitemselected(menuitem item){         mystring = pila.peek();     } } 

how can use stack through class functions in java?

parametrising means tell class (in case stack) type of objects instance (in case pila) contain. try code instead of yours:

stack<string> pila = new stack<string>() 

however, should not error warning far know.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -