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 7792647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:14:58+00:00 2026-06-01T22:14:58+00:00

I’m trying to pass two prameters ( fileURL AND fileNAme) from one class to

  • 0

I’m trying to pass two prameters ( fileURL AND fileNAme) from one class to another one,, but I’m getting errors I got,

   04-11 17:19:45.510: E/AndroidRuntime(2958): FATAL EXCEPTION: AsyncTask #1
    04-11 17:19:45.510: E/AndroidRuntime(2958): java.lang.RuntimeException: An error occured while 
executing doInBackground()
04-11 17:19:45.510: E/AndroidRuntime(2958):     at android.os.AsyncTask$3.done(AsyncTask.java:278)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.lang.Thread.run(Thread.java:856)
04-11 17:19:45.510: E/AndroidRuntime(2958): Caused by: java.lang.NullPointerException: println needs a message
04-11 17:19:45.510: E/AndroidRuntime(2958):     at android.util.Log.println_native(Native Method)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at android.util.Log.e(Log.java:231)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at com.androidhive.androidlistview.pdfDownload$DownloadFileFromURL.doInBackground(pdfDownload.java:155)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at com.androidhive.androidlistview.pdfDownload$DownloadFileFromURL.doInBackground(pdfDownload.java:1)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at android.os.AsyncTask$2.call(AsyncTask.java:264)
04-11 17:19:45.510: E/AndroidRuntime(2958):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
04-11 17:19:45.510: E/AndroidRuntime(2958):     ... 4 more

here’s

my first class that pass the parameters to the other class

        list.setOnItemClickListener(new ListView.OnItemClickListener() { 
         public void onItemClick(AdapterView<?> parent, View view, 
                  int position, long id) { 
                if (position == 0) { 
                    // pass parameters file name & file url 
                    Intent i = new Intent(ListView_SqliteActivity.this,pdfDownload.class); 
                    i.putExtra("FileName","hello.pdf"); 
                    i.putExtra("FileURL","http://www.gradsch.ohio-state.edu/depo/etd_tutorial/lesson2.pdf"); 
                    startActivity(i); 

                  } 

                    else{
                          Toast.makeText(ListView_SqliteActivity.this,
                                    " toast me " + listItemAdapter.getItem(position),
                                    Toast.LENGTH_SHORT).show();
                    }               }
        });

}

my second class that takes the parameters

public class pdfDownload extends Activity {

// button to show progress dialog
Button btnShowProgress;

// Progress Dialog
private ProgressDialog pDialog;
ImageView my_image;
// Progress dialog type (0 - for Horizontal progress bar)
public static final int progress_bar_type = 0; 
public static String fileURL;

// File url to download
public static String file_url = fileURL;
public static String fileName;



public static String file_name = fileName;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.download);

    // show progress bar button
    btnShowProgress = (Button) findViewById(R.id.btnProgressBar);
    // Image view to show image after downloading
    my_image = (ImageView) findViewById(R.id.my_image);
    /**
     * Show Progress bar click event
     * */
    btnShowProgress.setOnClickListener(new View.OnClickListener() {


            public void onClick(View v) { 
                file_name = getIntent().getStringExtra("fileName");  
                file_url = getIntent().getStringExtra("fileURL"); 
        // starting new Async Task 
        new DownloadFileFromURL().execute(file_url); 

            // starting new Async Task
            new DownloadFileFromURL().execute(file_url);
        }
    });
}

after fixing the previous error , a new one comes that is the toast “file not found “message from this class
`

protected void onPostExecute(String file_url) {
            // dismiss the dialog after the file was downloaded
            dismissDialog(progress_bar_type);

        }
        File pdfFile = new File("/mnt/sdcard/pass/"+ file_name);{ 
        if(pdfFile.exists()) { 
            Uri path = Uri.fromFile(pdfFile);  
            Intent pdfIntent = new Intent(Intent.ACTION_VIEW); 
            pdfIntent.setDataAndType(path, "application/pdf"); 
            pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
            try { 
               startActivity(pdfIntent); 
            } catch(ActivityNotFoundException e) { 
               Toast.makeText(pdfDownload.this, "No Application available to view pdf", Toast.LENGTH_LONG).show();  
            } 
        } else { 
            Toast.makeText(pdfDownload.this, "File not found", Toast.LENGTH_LONG).show();  
        } 
    }`

with new error messages

    04-11 18:06:40.809: E/AndroidRuntime(12884): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.ActivityThread.access$1300(ActivityThread.java:123)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.os.Looper.loop(Looper.java:137)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at java.lang.reflect.Method.invokeNative(Native Method)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at java.lang.reflect.Method.invoke(Method.java:511)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at dalvik.system.NativeStart.main(Native Method)
04-11 18:06:40.809: E/AndroidRuntime(12884): Caused by: java.lang.NullPointerException
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
04-11 18:06:40.809: E/AndroidRuntime(12884):    at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
04-11 18:06:40.809: E/AndroidRuntime(12884):    ... 11 more
  • 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-01T22:15:00+00:00Added an answer on June 1, 2026 at 10:15 pm

    At line 155 in your DownloadFileFromURL class you call Log.e() with an invalid parameter. Either the tag or the message is null, you can solve the problem by using this code: Log.e("tag",String.valueOf(errormessage));

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

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.