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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:33:15+00:00 2026-06-18T22:33:15+00:00

I have a android app having a layout containing a Listview, which is inflated

  • 0

I have a android app having a layout containing a Listview, which is inflated with

      LayoutInflater inflater = getLayoutInflater();
      row = inflater.inflate(R.layout.disc_row, parent, false);

the “R.layout.disc_row” is containing a SurfaceView drawing a canvas. so each row within the ListView is containing a Canvas. while scrolling the list the canvas is staying at its place while the other elements of the row are scrolling. I think its a poor behaviour of the device. the same app is not drawing anything on the emulator until clicking on a ListItem.

Is there any better strategy for drawing inside ListViews (no Bitmap, just some lines) maybe with Paint?
emulator sys it is doing too much work in the activity.

thanks in advance

attached CLASS

public class DrawDiscInListView extends SurfaceView implements
    SurfaceHolder.Callback {

private static final String TAG = "DISCONT SurfaceView";

public DrawDiscInListView(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
}

@Override
public void surfaceCreated(SurfaceHolder holder) {
    tryDrawing(holder);
}

@Override
public void surfaceChanged(SurfaceHolder holder, int frmt, int w, int h) {
    tryDrawing(holder);
}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
}

private void tryDrawing(SurfaceHolder holder) {
    Log.i(TAG, "Trying to draw...");

    Canvas canvas = holder.lockCanvas();
    if (canvas == null) {
        Log.e(TAG, "Cannot draw onto the canvas as it's null");
    } else {
        drawMyStuff(canvas);
        holder.unlockCanvasAndPost(canvas);
    }
}

private void drawMyStuff(final Canvas canvas) {
    Random random = new Random();
    Log.i(TAG, "Drawing...");
    canvas.drawRGB(255, 128, 128);
}

}

  • 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-18T22:33:16+00:00Added an answer on June 18, 2026 at 10:33 pm

    I did some research, I would like to share here:

    Instead of using SurfaceView I used finally ImageView:
    I used Canvas for creating a Bitmap and then used the bitmap in the Listview. It works fine and without loss of performance.

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

Sidebar

Related Questions

I have an android app which has native code. The native code needs to
I have an android app which let the user to submit a form ,
I am designing an Android app and I'm having a couple of layout issues.
I'm having trouble with button text alignment in my Android app. I have a
My Android app having many buttons. My main.xml layout has three buttons. I know
I am having another problem with my android app which I can't find an
I need some help creating a listview inside a layout i have. im having
I'm having problems with my first Android app. I have subclassed ListActivity, and I'm
I have android app . i should pass the data from android to web
I have Android client app that communicates with server using Socket . On my

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.