File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,16 @@ How to use
10
10
----------
11
11
Simply copy WorkerFragment.java into your project, then on your Activity's onCreate() do this:
12
12
13
- this.workerFragment = WorkerFragment.getWorkerFragment(this.getSupportFragmentManager() );
13
+ this.workerFragment = WorkerFragment.getWorkerFragment(this);
14
14
15
- If savedInstanceState == null, this is how your start your IntentService:
15
+ If savedInstanceState == null, you start your IntentService to do some background work :
16
16
17
17
Intent exampleIntent = new Intent(this, ExampleService.class);
18
18
exampleIntent.setAction(ExampleService.ACTION_GET_HELLO);
19
19
this.workerFragment.putReceiver(exampleIntent); /* this sets the WorkerFragment as receiver */
20
20
this.startService(exampleIntent);
21
21
22
- Then you implement the WorkerFragment.WorkerFragmentReceiver interface in your Activity:
22
+ Then you implement the WorkerFragment.WorkerFragmentReceiver interface in your Activity to handle the result :
23
23
24
24
@Override
25
25
public void onReceiveResult(int resultCode, Bundle resultData) {
@@ -32,7 +32,7 @@ Then you implement the WorkerFragment.WorkerFragmentReceiver interface in your A
32
32
break;
33
33
}
34
34
35
- Now in your service , sending your result is as simple as:
35
+ Now in your IntentService , sending your result is as simple as:
36
36
37
37
Bundle result = new Bundle();
38
38
result.putString(KEY_RESULT, "hello world!");
You can’t perform that action at this time.
0 commit comments