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

  • Home
  • SEARCH
  • 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 9017287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:13:57+00:00 2026-06-16T04:13:57+00:00

Hello I try to launch a IntentService with string as extra but it throws

  • 0

Hello I try to launch a IntentService with string as extra but it throws a null pointer exception, I search but I didnt found anything, so I ask it. Seems that the service can’t extract the extras of the intent, and I don’t know if is because I forget something, is the first time that I work with IntentService.

Well, in the main I throw the intent:

    String url = MY_HOST+"/videos/video.mp4";
    Intent intent = new Intent(this, VideosDownloader.class);
    intent.putExtra("url", url);
    startService(intent);

And in the service I manage the extra:

public class VideosDownloader extends IntentService{


public VideosDownloader() {
    super("VideosDownloader");
    // TODO Auto-generated constructor stub
}

@Override
public IBinder onBind(Intent arg0) {
    // TODO Auto-generated method stub
    return null;
}

 @Override
 protected void onHandleIntent(Intent intent) {

        String url = intent.getStringExtra("url");
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
        request.setDescription("Some descrition");
        request.setTitle("Some title");

        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "video.mp4");
        request.setVisibleInDownloadsUi(true);
        // get download service and enqueue file
        DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
        manager.enqueue(request);

 }
}

and in the Manifest I think is everything ok, I declare as service:

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:debuggable="true" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <service android:name=".VideosDownloader"/>
</application>

The error throw is:

12-19 08:45:50.482: E/AndroidRuntime(15470): FATAL EXCEPTION: main
12-19 08:45:50.482: E/AndroidRuntime(15470): java.lang.RuntimeException: Unable to start service com.example.downloadtest.VideosDownloader@40525e50 with Intent { cmp=com.example.downloadtest/.VideosDownloader (has extras) }: java.lang.NullPointerException
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2073)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.ActivityThread.access$2800(ActivityThread.java:121)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1006)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.os.Looper.loop(Looper.java:138)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.ActivityThread.main(ActivityThread.java:3701)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at java.lang.reflect.Method.invokeNative(Native Method)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at java.lang.reflect.Method.invoke(Method.java:507)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at dalvik.system.NativeStart.main(Native Method)
12-19 08:45:50.482: E/AndroidRuntime(15470): Caused by: java.lang.NullPointerException
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.IntentService.onStart(IntentService.java:110)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.IntentService.onStartCommand(IntentService.java:118)
12-19 08:45:50.482: E/AndroidRuntime(15470):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2060)
12-19 08:45:50.482: E/AndroidRuntime(15470):    ... 10 more

Thanks for the reply.

SOLVED: Sorry my fault, David Wasser gave me the solution asking if I posted all code, I override Oncreate() doing nothing, and I forget that it should have super so I deleted it (because it did nothing). Thnaks for the replys!

  • 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-16T04:13:59+00:00Added an answer on June 16, 2026 at 4:13 am

    SOLVED: Sorry my fault, David Wasser gave me the solution asking if I posted all code, I override Oncreate() doing nothing, and I forget that it should have super so I deleted it (because it did nothing). Thnaks for the replys!

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

Sidebar

Related Questions

hello guys i am try to use the StringUtils.remove Method but the below exception
hello guys i am try to eliminate all the duplicate strings from a string
Hello I try to write a HTTP Request in C# (Post), but I need
Hello I try to connect F# and MySQL database, but i got fallowing error
public class LineNum1 extends Thread{ public synchronized void run() { try { Hello.main(null); System.out.println(Stack
Hello everyone I try to solve asterisk tree problem and found my code is
Hello I try to use PcapDotNet dll but I can't add reference to my
I try to make simple hello world app for facebook. But when i try
Hello I try to create a function to generate select functions. But the following
Hello i try to create bash function search videos file in folder and if

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.