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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:57:41+00:00 2026-06-03T22:57:41+00:00

I am developing a file encryption and decryption app and to show the user

  • 0

I am developing a file encryption and decryption app and to show the user a little progress bar of the file encryption and decryption. I need to implement a progress bar. How do I do that ? For the below code.

    public void main(String[] args) throws Exception
      {

         // File to decrypt.
      filename = "/file.enc";

      String password = "codecodecode";

      inFile = new FileInputStream(new File(Environment.getExternalStorageDirectory()+ filename));
      outFile = new FileOutputStream(new File(Environment.getExternalStorageDirectory()+ filename + ".txt"));

      PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
      SecretKeyFactory keyFactory =
          SecretKeyFactory.getInstance("PBEWithMD5AndDES");
      SecretKey passwordKey = keyFactory.generateSecret(keySpec);

      // Read in the previouly stored salt and set the iteration count.

      byte[] salt = new byte[8];
      inFile.read(salt);
      int iterations = 100;

      PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, iterations);

      // Create the cipher and initialize it for decryption.

      Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
      cipher.init(Cipher.DECRYPT_MODE, passwordKey, parameterSpec);


      byte[] input = new byte[64];
      int bytesRead;
      while ((bytesRead = inFile.read(input)) != -1)
      {
         byte[] output = cipher.update(input, 0, bytesRead);
         if (output != null)
            outFile.write(output);
      }

      byte[] output = cipher.doFinal();
      if (output != null)
         outFile.write(output);

      inFile.close();
      outFile.flush();
      outFile.close();
  }
  • 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-03T22:57:42+00:00Added an answer on June 3, 2026 at 10:57 pm

    Check the tutorial on progress bars: https://developer.android.com/guide/topics/ui/dialogs.html#ShowingAProgressBar

    There is also the “Example ProgressDialog with a second thread” – nice to check.

    Also consider using AsyncTask for such kind of things, it has a built in support for publishing progress update events on UI thread.

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

Sidebar

Related Questions

I am developing a java based eclipse plugin that monitors file activity. I need
I'm developing a java web app on my local PC that uses a file
I'm developing web page which has main file index.php as follows: include('UserClass.php'); include('html/top.php'); $user
I'm developing a solution that allows people to upload a DOCX file as a
I'm developing an extension for Google Chrome that generates an mp3 file and saves
I am developing a desktop application that will need to collect data (from the
Iam developing one applcation.In that,in my xml file having the threetags with same name
For a small file format I'm developing I need to output a header of
I'm developing an app in C++/CLI and have a csv file writing library in
I'm currently developing an application that happens to require some file preprocessing before actually

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.