Android: unable to lauch new Activity from an inner class -
android: help: notice kind of question has been asked before other people answers have not been useful my case; need launch new activity inner class error bellow:
04-05 15:00:43.851: e/androidruntime(3288): caused by: java.lang.instantiationexception: com.school.school$studentprofile here code snippet:
public class school extends activity{ progressdialogue progressdialogue; protected webviewtask _webtask; string path = "http://www.school.com/student/"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.school); progressdialogue = new progressdialogue(school.this); _webtask = new webviewtask(); _webtask.execute(); } //rest of code /** inner class */ public class studentprofile { context context; /** instantiate interface , set context */ public studentprofile(context c) { context=c; } /** launch student activity */ public void lauchprofile() { school.this.startactivity(new intent(school.this, studentprofile.class)); //intent intent = new intent(school.this, studentprofile.class); //startactivity(intent); } } void webview(){ string url = path +"student.php"; webview wv = (webview) findviewbyid(r.id.trivia_webview); websettings websettings = wv.getsettings(); websettings.setjavascriptenabled(true); wv.addjavascriptinterface(new studentprofile (this), "student"); wv.loadurl(url); wv.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { // open url in web view if (url.contains(url)) return super.shouldoverrideurlloading(view, url); // open url in external web browser else { return true; } } }); } // rest of code note: there 'student' button on web view supposed launch studentprofile activity.
your studentprofile not activity, can not start way. needs separate class, , declared in androidmanifest.xml.
Comments
Post a Comment