In this code I create a Node class:
public class Node
{
private String data;
private Node next;
//
public void setData(String s)
{
data = s;
}
public Strinf getData()
{
return data;
}
//
public void setNext(Node n)
{
next = n;
}
public Node getNext()
{
return next;
}
and I using of this class in below class:
public class A
{
public int countFunc(String s)
{
return s.length();
}
}
public Main extends Activity
{
...
Node n = new Node();
n.setNext(null);
n.setData("A");
A objA = new A();
int i = objA.countFunc(n.getData());
...
}
After that run application, the application has been show:
Unfortunately,Main has been Stopped
but when I use it in Toast,for example:
Toast.makeText(this, n.getData(), Toast.LENGTH_LONG).show();
no error has been show! and run successfully! How i do? thanks.