I am making a Class object in order to start a new activity. But the problem is when I type
Class ourclass = new Class.__
It doesn’t recognise the Class and I can’t use the methods of the super class “Class”. It says class is a raw type. What type should I assign it to, because I want to use “forName()” method in which I want to pass a class name.
Here is the code
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
try
{
Class ourclass =Class.__ // The suggestions for static functions doesn't popup, and I get errors
//Intent myintent = new Intent();
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
}
Regards.
Class.forNameis a static method – you don’t call it on an instance:(Whether this is actually appropriate or not when starting an activity is a different matter, but this answer just addresses the
Class.forNamepart…)