Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:05:44+00:00 2026-06-06T00:05:44+00:00

I am working on an application. To make simple, it has this design :

  • 0

I am working on an application. To make simple, it has this design :

ServiceManager <——–> CommService ——-> doing stuff via AsyncTask…

I am trying to bound my ServiceManager to CommService. So, CommService has a Binder. And I have a NullPointerException and I don’t know how to fix it. I think the ServiceConnection don’t do its job and the bind is not active.

Code of ServiceManager here :

public class ProbeManagerService extends Service implements ICommManager, ICommListener {
    private CommService mService;
    private boolean mBound;

    private ServiceConnection svc1 = new ServiceConnection() {
    public void onServiceConnected(ComponentName className, IBinder rawBinder) {
        CommBinder commBinder = (CommBinder) rawBinder;
        mService = commBinder.getService();
        mBound = true;
    }

    public void onServiceDisconnected(ComponentName className) {
        //commBinder = null;
        mBound = false;
    }
    };

    public void onCreate() {
        Log.i("ProbeManagerService, onCreate", "passage dans le onCreate du Service");
        super.onCreate();
        Intent bindIntent = new Intent(this, CommService.class);
        //startService(bindIntent); changes nothing with or without this line
        bindService(bindIntent, svc1, Context.BIND_AUTO_CREATE);
   }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }


    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i("ProbeManagerService, onStartCommand", "passage dans le onStartCommand du Service");
        this.getActions();
        return START_STICKY;
    }


    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void getActions() {
        if(mBound)
            this.mService.getActions(this, urlGetActions, jsonGetActions, GET_ACTIONS);
        else
            System.out.println("On n'est pasl lié");

    }

Code of CommService here :

public class CommService extends Service implements IComm {

private final CommBinder binder = new CommBinder(this);
private HttpClient client;


public CommService() {
    super();
}

public void onCreate() {
    super.onCreate();
    this.client = new DefaultHttpClient();
}

@Override
public IBinder onBind(Intent intent) {
    return binder;
}

public void onDestroy() {
    super.onDestroy();
    this.client.getConnectionManager().shutdown();
}

// ============ METHODES A IMPLEMENTER DE L'INTERFACE IComm ==============
@Override
public void getActions(ICommListener listener, String url, String json, String type) {
    new SendHttpRequest(listener).execute(url, json, type);

}

Code of CommBinder here :

public class CommBinder extends Binder {

private CommService service;

public CommBinder(CommService service) {
    this.service = service;
}

public CommService getService() {
    return this.service;
}

Logcat here :

06-19 18:03:35.665: I/ProbeManagerService, onCreate(25705): passage dans le onCreate du Service
06-19 18:03:35.775: I/System.out(25705): fichier lus
06-19 18:03:35.785: I/ProbeManagerService, onStartCommand(25705): passage dans le onStartCommand du Service
06-19 18:03:35.815: D/AndroidRuntime(25705): Shutting down VM
06-19 18:03:35.815: W/dalvikvm(25705): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-19 18:03:35.855: E/AndroidRuntime(25705): FATAL EXCEPTION: main
06-19 18:03:35.855: E/AndroidRuntime(25705): java.lang.RuntimeException: Unable to start service .probecontroller.android.services.ProbeManagerService@40516da8 with Intent { cmp=.probecontroller.android.controller/.probecontroller.android.services.ProbeManagerService }: java.lang.NullPointerException
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2052)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.app.ActivityThread.access$2800(ActivityThread.java:117)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:994)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.os.Looper.loop(Looper.java:123)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.app.ActivityThread.main(ActivityThread.java:3683)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at java.lang.reflect.Method.invokeNative(Native Method)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at java.lang.reflect.Method.invoke(Method.java:507)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at dalvik.system.NativeStart.main(Native Method)
06-19 18:03:35.855: E/AndroidRuntime(25705): Caused by: java.lang.NullPointerException
06-19 18:03:35.855: E/AndroidRuntime(25705):    at .probecontroller.android.services.ProbeManagerService.getActions(ProbeManagerService.java:162)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at .probecontroller.android.services.ProbeManagerService.onStartCommand(ProbeManagerService.java:124)
06-19 18:03:35.855: E/AndroidRuntime(25705):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2039)
06-19 18:03:35.855: E/AndroidRuntime(25705):    ... 10 more
06-19 18:03:51.226: I/Process(25705): Sending signal. PID: 25705 SIG: 9

Any help is welcome. It’s been hours working on this problem and I read a lot of forums, posts, and nothing work at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:05:45+00:00Added an answer on June 6, 2026 at 12:05 am

    You are invoking getActions() on ProbeManagerService before the service is bound, apparently, because the only thing that can be null is mService. bindService() is asynchronous; you will not yet be bound when that method returns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to make a simple 2D application, and our image processing professor has
I'm working on a relatively simple iPhone application that has a multi-round Timer with
I am trying to make a simple application ( using theos on my device
My team has to make some changes and renew an old web application. This
I am working on an ASP.NET application that make a lot of jquery and
I have been working on an application which allows the user to make a
I'm working with an application, and I am able to make C# scripts to
I'm working on an html5 application built on CouchDB. I want to make sure
I'm rather newbie on Android, and I'm working on a simple application to get
I'm trying to a make a simple class in an actionscript file that handles

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.