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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:41:47+00:00 2026-06-06T01:41:47+00:00

In my Android Application i have to download video from Amazon bucket. When I

  • 0

In my Android Application i have to download video from Amazon bucket. When I try to download video from Amazon bucket, After some time it gives error like

06-16 12:01:55.792: I/System.out(577): ERROR in Thread : java.io.IOException: null SSL pointer

Here Code for download video from Amazon s3 bucket

public class AmazonS3Helper 
{
GeneralHelper objHelper;
Context myContext;
String bucketName;
String accessKey;
String secretKey;

ProgressBar myProgressBar;

AWSCredentials credential;

int len;
int total = 0;

public AmazonS3Helper(Context context,List list)
{
    try
    {
        myContext = context;
        objHelper = new GeneralHelper(myContext);

        bucketName = "mybucketName";
        accessKey = "myaccesskey";
        secretKey = "mysecretkey";

        credential = new BasicAWSCredentials(accessKey, secretKey);

        getFileFromAmazonS3(list);
    }
    catch (Exception ex) 
    {
        System.out.println("ERROR : "+ex.toString());
    }
}

public AmazonS3Helper(Context context,String amazonObjectName,ProgressBar progress)
{
    try
    {
        myContext = context;
        objHelper = new GeneralHelper(myContext);
        //progressBar = progress;

        bucketName = "mybucketname";
        accessKey = "key";
        secretKey = "key";

        credential = new BasicAWSCredentials(accessKey, secretKey);

        getFileFromAmazonS3(amazonObjectName,progress);
    }
    catch (Exception ex) 
    {
        System.out.println("ERROR : "+ex.toString());
    }
}

public void getFileFromAmazonS3(List list)
{
    try
    {
        List<DownloadItemList> downloadList = list;

        List<S3Object> s3ObjectList = new ArrayList<S3Object>();

        for(int i=0;i<downloadList.size();i++)
        {
            DownloadItemList downloadItem = downloadList.get(i);

            String objectImageKey = downloadItem.getEncryptName()+".app/"+downloadItem.getImageName();
            String objectAudioKey = downloadItem.getEncryptName()+".app/"+downloadItem.getAudioName();

            GetObjectRequest objRequest = new GetObjectRequest(bucketName,objectImageKey);
            AmazonS3Client myS3Client = new AmazonS3Client(credential);
            S3Object s3Object = myS3Client.getObject(objRequest);

            s3ObjectList.add(s3Object);             

            objRequest = new GetObjectRequest(bucketName,objectImageKey);
            myS3Client = new AmazonS3Client(credential);
            s3Object = myS3Client.getObject(objRequest);

            s3ObjectList.add(s3Object);
        }
    }
    catch (Exception ex) 
    {
        System.out.println("ERROR : "+ex.toString());
    }
}


// For Video
public void getFileFromAmazonS3(String strObjectName,ProgressBar progress)
{
    try
    {   
                    String md5Name = objHelper.getMD5HasCode(strObjectName);

        String strObjectKey = "video path";

        GetObjectRequest objRequest = new GetObjectRequest(bucketName,strObjectKey);

        AmazonS3Client myS3Client = new AmazonS3Client(credential);

        S3Object s3Object = myS3Client.getObject(objRequest);

        String filePath = strObjectName+"_video.mp4";

        System.out.println("OK - 8");

        downloadObject(s3Object,filePath,progress);         


    }
    catch (Exception ex) 
    {
        System.out.println("ERROR : "+ex.toString());
    }
}

private void downloadObject(S3Object s3Object,String path,ProgressBar progress)
{
    try
    {
        myProgressBar = progress;

        System.out.println("OK - 8");

        String filePath = objHelper.getFullFilePath(path); // + "noha_video1.mp4";

        System.out.println("FilePath : "+filePath);

        final long fileSize = s3Object.getObjectMetadata().getContentLength();
        final InputStream input = s3Object.getObjectContent();
        final FileOutputStream fos = new FileOutputStream(filePath);

        myProgressBar.setMax((int) fileSize);

        System.out.println("Input Stream Length : " + fileSize);

        final byte[] buf = new byte[1024];

        Thread thread = new Thread()
        {
            public void run()
            {
                try
                {
                    total = 0;

                    while((len = input.read(buf)) > 0)
                    {
                        fos.write(buf,0,len);

                        total = total + len;

                        Message msg = handler.obtainMessage();
                        Bundle b = new Bundle();
                        b.putInt("total", total);
                        msg.setData(b);
                        handler.sendMessage(msg);

                    }
                    if(len == -1 && total==Integer.parseInt(String.valueOf(fileSize)))
                    {
                        Thread.currentThread().interrupt();

                        input.close();
                        fos.close();

                        objHelper.startTargetActivity(myContext, VideoActivity.class);
                    }
                }
                catch (Exception ex) 
                {
                    System.out.println("ERROR in Thread : "+ex.toString());
                }
            }
        };

        thread.start();
    }
    catch (Exception ex) 
    {
        System.out.println("ERROR in Run Thread : "+ex.toString());
    }
}

Handler handler=new Handler() 
{

    @Override

    public void handleMessage(Message msg) 
    {
        myProgressBar.setProgress(msg.getData().getInt("total"));

    }

};

}

  • 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-06T01:41:50+00:00Added an answer on June 6, 2026 at 1:41 am

    can you check the URL finally Generated for Getting the File, paste the same URL in Browser & Check weather it’s 'http' o 'https' sometimes when you post as 'http' it converts to 'https' if it’s 'https' then you have to get the Certificates.

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

Sidebar

Related Questions

I want to download file from internet in my Android application. I have used
I have to get the time of download in my android application, that's why
I have a problem regarding Android App. I have created an application that download
I would like to develop an Android application which will have a local database.
I have an android application in which I have to execute some tasks at
I am creating an Android application which will have some embedded music inside of
now I am doing an Android application.I have to read a file from sdcard.I
I have an application that uses pictures, audio and some text from .txt... The
I have an Android application on Android Market, but some users are complaining about
In the android application that we are building, we would like to have a

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.