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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:40:43+00:00 2026-05-28T02:40:43+00:00

I am working with small application for display bubbles images on android screen.I have

  • 0

I am working with small application for display bubbles images on android screen.I have displayed all bubbles images from resource directory.I have implemented code as follows in view class.

onDraw method:

    @Override
protected void onDraw(Canvas canvas) 
{
    super.dispatchDraw(canvas);


    drawImages(canvas);

}

I have implemented drawImages() method as follows:

BitmapFactory.Options opts = new BitmapFactory.Options();   
private void drawImages(Canvas canvas) 
{

        for(int i = 0; i<MAX_ROWS; i++){
            for(int j=0; j<MAX_COLS; j++)
            {
                bmp = BitmapFactory.decodeResource(mContext.getResources(), items[i][j],opts);
                    canvas.drawBitmap(bmp,j*bmp.getWidth()+j*2,i*bmp.getHeight()+i*2,mBitmapPaint);
            }
        }

}

By using the above method i have drawn images from items[i][j].
I have implemented the initialize() override method as follows:

 @Override
protected void initialize() 
{

    for(int i=0;i<MAX_ROWS;i++)
        for(int j=0;j<MAX_COLS;j++)
        {
            items[i][j] = ImagesStore.ImageList.get(list_Indx);
            list_Indx++;
            if(list_Indx == ImagesStore.ImageList.size())
                list_Indx = 0;

    }
    opts.inSampleSize = 4;
    width  = getWidth();
    height = getHeight();

}

By using above code i have displayed all the bubble images on my emulator screen.

Here i would like to swap the bubbles which selects two bubbles by the user simultaneously.

I have implemented onTouchEvent method for check the bitmap image item position on screen as follows:

               int x = 0;
               int y = 0;
               int tx = 0, ty = 0;   
           @Override
public boolean onTouchEvent(MotionEvent event) 
{

     tx = (int)event.getX();
     ty = (int)event.getY();
    int position;

        x=tx;
        y=ty;

        row = (y) / bmp.getHeight();
        col = x / bmp.getWidth();

        position=row*MAX_COLS+(col+1);

        Log.v("row", "=====>"+row);

        Log.v("col", "=====>"+col);

        Log.v("position", "=====>"+position);

    count++;

    if(count%4==0)
    {

    Log.v("count", "=====>"+count);


    //I would like to implement swap code here



    }   
    return true;
}

From the above code How can i swap(inter change the images) bitmap images implementation at onTouchEvent()

Please any body help me…………..

  • 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-05-28T02:40:43+00:00Added an answer on May 28, 2026 at 2:40 am

    Please define the functionality that you desire as..

    “Here i would like to swap the bubbles which selects two bubbles by the user simultaneously.”

    is not a complete sentence.

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

Sidebar

Related Questions

Hi i made one small application to show all sdcard images should display in
Im working on a small application to try out an idea that I have.
I have a small application I am working on that at one point needs
i have developed a small application and was working fine on developing machine but
I am working on a small AIR desktop application and I have some configuration
I'm working on a small application from scratch and using it to try to
I'm working on a small application in Java that takes a directory structure and
I am working on a small reporting application. I have two tables Agent Table
I am working on a Small silverlight application to resize images on the client
I am working towards producing a small application that parses XML from a URL

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.