java - Non-Extended Classes in android -
i have class scores.java need know whats correct way create these. "the constructor scores not defined. have extend off in android??
package com.threeuglymen.android.stuff; import android.app.application; import android.app.service; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.content.sharedpreferences.editor; import android.preference.preferencemanager; import android.util.log; public class scores { private context mycontext; public scores (context context) { // todo auto-generated method stub this.mycontext = context; } public void resetscores(){ try { sharedpreferences pref = preferencemanager.getdefaultsharedpreferences(mycontext); editor edit = pref.edit(); edit.putint("correct", 0); edit.putint("incorrect", 0); edit.commit(); } catch (exception e) { log.d("scores", "exception:" + e.tostring()); } return; } }
thx guidance
eric
what have should work. in main activity, don't call
scores score = new scores();
instead call
scores score = new scores(getcontext());
let me know if works.
Comments
Post a Comment