Can't figure out this compile error

by Tobiah » Sat, 15 Jan 2011 01:58:38 GMT


Sponsored Links
 Trying to launch an IntentService:


package com.rcsreg.exposmart;
import android.app.IntentService;
import android.util.Log;
import android.content.Intent;

public class Sync extends IntentService{

        Integer counter = 0;

        public void Sync(){
                super("Sync");
        }

        @Override
        protected void onHandleIntent(Intent intent){
                while(1 == 1){
                        Log.e("INTENT!!!!", String.format("COUNT IS %d", 
counter++));
                        try{
                                Thread.sleep(3000);
                        } catch (Exception e){
                        }
                }
        }
}


Compiler says:

[javac] Compiling 2 source files to /home/toby/android/exposmart/bin/classes
    [javac] /home/toby/android/exposmart/src/com/rcsreg/exposmart/Sync.java:6: 
cannot find symbol
    [javac] symbol  : constructor IntentService()
    [javac] location: class android.app.IntentService
    [javac] public class Sync extends IntentService{
    [javac]        ^
    [javac] /home/toby/android/exposmart/src/com/rcsreg/exposmart/Sync.java:11: 
call to super must be first statement in constructor
    [javac]             super("Sync");
    [javac]                  ^
    [javac] 2 errors

Thanks,


Tobiah

--



Re: Can't figure out this compile error

by Hari Edo » Sat, 15 Jan 2011 03:28:17 GMT


 > public class Sync extends IntentService
--->   Integer counter;
--->               counter = 0;
...

-- 


Sponsored Links


Re: Re: Can't figure out this compile error

by Tobiah » Sat, 15 Jan 2011 03:50:31 GMT


 

public class Sync extends IntentService {
---> Integer counter;
public void Sync() { super("Sync");
---> counter = 0;
}
...
}
It turned out that I needed to axe the 'void' in the constructor. Thanks --



Other Threads

1. Opening local URLs using the emulator browser



Is it possible for the emulator's browser to read the local disk on the machine it is running on and read/execute javascript code? All I was able to achieve was to open public URLs - even though I have not managed yet to get it to connect to the public Net.
Assuming you mean a html page coming from the local file system that is in your app bundle, the answer is yes. yourwebview.loadDataWithBaseURL ("file:///android_asset/", page, "text/html", "utf-8", null); where page is something like R.raw.yourwebpage. All you need to do is put your html files in res/raw and it works like a charm. Mike --

2. Brut google maps update

Brut google maps update v4.3.0 brut 14 http://bit.ly/cHHtTF

Regards. Adri

-sent from my google powered device #android-

-- 
"Indonesian Android Community [id-android]" 

3. Problem after implementing SQLiteOpenHelper

4. Integrating the timer with my game

5. gpstest for emulator is not working

6. Official Yahoo! Apps!

7. Fwd: gdata calendar not working with android.