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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:30:10+00:00 2026-06-11T04:30:10+00:00

My test Android app has a single activity, LoadImage, with two methods: an onCreate

  • 0

My test Android app has a single activity, LoadImage, with two methods: an onCreate method that processes images with OpenCV, and a Display method which displays the image on the screen for 5 seconds. Here is what I have so far for the Display method:

[convert OpenCV matrix to a bitmap using an OpenCV method]

Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(bitmap, 0, 0, null);

try {
    synchronized (this) {
        wait(5000);
    }
} catch (InterruptedException e) {
}

and here is the XML file for the single activity (it’s a blank screen):

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</RelativeLayout>

If I run the code as-is, I get… a blank screen. How do I get the bitmaps to show up?

Thanks so much.

  • 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-11T04:30:13+00:00Added an answer on June 11, 2026 at 4:30 am

    Try this:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
    <ImageView
                android:id="@+id/imageView1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="2dp"/>
    </RelativeLayout>
    

    And do this in your java code:

    onCreate()
    {
        ImageView imageView = (ImageView) findViewById(R.id.imageView1);
    }
    

    You are sending the bitmap to the canvas right?

    So do this there in your method where you are drawing into the bitmap.

    imageView.setImageBitmap(bitmap);
    

    You can not set the canvas directly to the imageView1.

    Because as you know in real life, the canvas is just a brush. In the same way here also the canvas is only a brush. so dont worry about it.your edited image is now stored in the bitmap only. So thats why you can directly set the bitmap after editng by canvas.

    • 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 that in the onCreate() method, preloads a lot of
This is my FragmentListArraySupport.java package com.test.methods; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.ListFragment; import android.util.Log;
I have setup an android test project that runs junit tests. It's using two
I'm looking for a way to detect that my android app has been backgrounded,
My Android app has a ContactsList activity in which I simply display a list
We have an Android app that has been submitted to the App Center. My
I am working on an Android app. It has corresponding spec/test application. As part
I need to test my Android app for playing flash objects in the WebView.
I just started looking at android app development. For my first test app i
I've created an app on Android 2.2 and used emulator to to test the

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.