I have created an Activity class and defined a constructor:
public class Spinner_Name extends Activity{
List<String> listSp;
public Spinner_Name(List<String> list)
{
listSp = new ArrayList<String>();
listSp = list;
}
@Override
public void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.spinner_layout);
}
}
And I want to call that Activity from this Activity:
public class MAIN extends Activity{
List<String> listSp;
@Override
public void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.spinner_layout);
listSp = new ArrayList<String>();
listSp.add("a");
}
}
But when I run the application this message shows up:
Unfortunately, Main has been stopped
When I delete the argument from the constructor the application runs successfully. How do I get the activity to run with the argument??