Note that there are some explanatory texts on larger screens.

plurals
  1. POError when trying initialize a service ( which extends IntentService class)
    primarykey
    data
    text
    <p>I try to play with Service in Android, my application contain an Activity with a button so that it can do action when I press it. The core component is the ExtractingURLService , which extends IntentService framework class. I have overrided the onHandleIntent() method, so that it can handle intent passed to it properly. Code:</p> <pre><code>public class ExtractingURLService extends IntentService { private static final String TAG = "ExtractingURLService"; public ExtractingURLService(String name) { super("ExtractingURLService"); } @Override protected void onHandleIntent(Intent intent) { // do something here ! } } } </code></pre> <p>The Android Manifest file is :</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="example.service.urlextraction" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".ServiceExample02Activity" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;service android:name=".ExtractingURLService" android:enabled="true"&gt;&lt;/service&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>In my only Activity class, I call the service by using:</p> <pre><code>Intent startServiceIntent = new Intent(this, ExtractingURLService.class); startService(startServiceIntent); </code></pre> <p>That's all my work, but when deploy, the runtime error I received was:</p> <blockquote> <p>04-09 16:24:05.751: ERROR/AndroidRuntime(1078): Caused by: java.lang.InstantiationException: example.service.urlextraction.ExtractingURLService</p> </blockquote> <p>What I should do with that ?? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload