-2

I am defining a variable in application class like this

public static ResultReceiver myResultReceiver = null;

In some activities I am extending ResultReceiver and assigning to myResultReceiver, in stop() of activities I am making it null. Though myResultReceiver is not null yet when I access it from an intentservice it is null. The code was working fine till today.

Ahmed Hegazy
  • 12,395
  • 5
  • 41
  • 64
Prashanth Debbadwar
  • 1,047
  • 18
  • 33

2 Answers2

1

May be, just may be you have the service on another process using the android:process or android:isolatedProcess attribute. If so, that makes a separate isolated new process which the Service runs in and it's impossible to read any data from another process even static variables except using IPC or SharedPreferences.

If you don't need the attribute then remove it and save yourself from the hassle.

Ahmed Hegazy
  • 12,395
  • 5
  • 41
  • 64
0

@Ahmed Hegazy is correct. Problem was I have added android:process in manifest to kill intent service because of that I am not able to access.

Prashanth Debbadwar
  • 1,047
  • 18
  • 33