我試圖綁定服務和另一個類之間的額外服務我已經建成,但我遇到了麻煩,因爲強制關閉錯誤,指出「java.lang。的NullPointerException在com.test.generic.clientprovisioninghandler.DataCountService.onStartCommand(DataCountService.java:46)」NullPointerException當試圖捆綁服務和另一個類之間的其他類
哪一個是線捆綁額外= getIntent()getExtras();
有關如何解決此問題的任何建議非常感謝!
來源:
public class DataCountService extends Service {
String text = "USR;1";
String ERROR = Constants.PREFS_NAME;
private Timer timer = new Timer();
private long period;
private long delay_interval;
private Intent getIntent() {
// TODO Auto-generated method stub
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(Constants.TAG, "Logging Service Started");
if (intent == null) {
// Exit gracefully is service not started by intent
Log.d(Constants.TAG, "Error: Null Intent");
} else {
Bundle extras = getIntent().getExtras();
if (extras != null) {
text = extras.getString(Constants.DM_SMS_CONTENT);
// check for Enable or Disable Value - if set to enable
// check for Enable or Disable Value - if set to enable
if (extras.getString(Constants.DM_SMS_CONTENT).contains(
"//USR;1")) {