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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:58:26+00:00 2026-06-09T18:58:26+00:00

My program on Android uses an algorithm that uses a lot of setPixel and

  • 0

My program on Android uses an algorithm that uses a lot of setPixel and getPixel, therefore, it’s very slow. On .NET, I can use LockBits to make it faster. Is there LockBits or similar on Java or Android?

EDIT: After some searches, I found copyPixelToBuffer and copyPixelFromBuffer, wonder if it is what I need?

  • 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-09T18:58:28+00:00Added an answer on June 9, 2026 at 6:58 pm

    Yes, you should use the above two methods and make use of a ByteBuffer object where you will be first storing all the bitmap data. After doing so, copy all the buffer data into a byte array and then you can do all you argb manipulations within this array. After all done, wrap this byte array into a newly allocated ByteBuffer and then finally copy the pixels back from this buffer into the original bitmap.
    Here’s some sample:
    “bmpData” is your Bitmap object holding image pixel data.

    int size = bmpData.getRowBytes()*bmpData.getHeight()*4;
    ByteBuffer buf = ByteBuffer.allocate(size);
    bmpData.copyPixelsToBuffer(buf);
    byte[] byt = buf.array();
      for(int ctr=0;ctr<size;ctr+=4)
        {
          //access array in form of argb. for ex. byt[0] is 'r', byt[1] is 'g' and so on..
        }
    ByteBuffer retBuf = ByteBuffer.wrap(byt);
    bmpData.copyPixelsFromBuffer(retBuf);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a Android Web Services program that uses a number
I am trying to cross-compile a very simple program for Android that worked with
So I created a simple hello world program that uses ksoap2 on Android 2.3
I'm trying to program an Android interface which uses an expandable list on the
I write a test program for Android, I record audio from mic and use
I am writing an alarm program for android and am very happy with it
I have written a simple Android application that uses a sqlite database which is
i am developing a program which uses the android camera to take pictures. but
My program switches between two Activities that each inflate a derived GLSurfaceView that uses
I'm developing an Android application for Android 2.2. When I run a program that

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.