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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:17:42+00:00 2026-05-21T12:17:42+00:00

This is my first blackberry app and I am attempting to make a simple

  • 0

This is my first blackberry app and I am attempting to make a simple game for a touch screen device.
Its the typical image split into tiles and you have to unscramble them so the tiles are in the correct order and show the picture.
The intention is that the user will be able to “drag” a tile anywhere they want on the screen and they will swap places with the tile they drop it over.

I am using bitmapbuttons for my tiles

    HorizontalFieldManager hfm = new HorizontalFieldManager();
    add(hfm);
    hfm.add(button1);
    hfm.add(button2);
        etc...

I have a class called Puzzle screen as follows:

class PuzzleScreen extends MainScreen implements FieldChangeListener {

I have added the following to try and detect the movement of the persons touch on the screen

protected boolean touchEvent(TouchEvent event) { 
case TouchEvent.MOVE:

            PuzzleTile fieldMove = (PuzzleTile) this.getLeafFieldWithFocus();

            // Dialog.alert("MOVE");

            int[] x_points;
            int[] y_points;
            int[] time_points;
            int size = event.getMovePointsSize();
            x_points = new int[size];
            y_points = new int[size];
            time_points = new int[size];
            event.getMovePoints(1, x_points, y_points, time_points);
                            return true;
        }

        return false;
    }

I need to find which image tile (bitmapbutton) is at the position of the upevent.
I have the coordinates (I think) above but not sure how to find which tile that relates to.

Bex

  • 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-21T12:17:43+00:00Added an answer on May 21, 2026 at 12:17 pm

    Something like this.

    static class TestScreen extends MainScreen  {
    
        private static String down;
    
        public TestScreen () {
            HorizontalFieldManager hfm = new HorizontalFieldManager();
            add(hfm);
            hfm.add(new TestButton("bt1"));
            hfm.add(new TestButton("bt2"));
            hfm.add(new TestButton("bt3"));
            hfm.add(new TestButton("bt4"));
            hfm.add(new TestButton("bt5"));
            hfm.add(new TestButton("bt6"));
        }
    
        public static void touchDown(TestButton tb) {
            down = tb.getText();
            System.out.println("DOWN in " + tb.getText());
        }
    
        public static void touchUp(TestButton tb) {
            System.out.println("UP in " + tb.getText());
            if(!down.equals(tb.getText()))
                System.out.println("swap " + down + " and " + tb.getText());
            down = "";
        }
    
    
    
    
    class TestButton extends LabelField {
    
        public TestButton (String label) {
            super(label);
        }
    
        protected boolean touchEvent(TouchEvent event) { 
            if(event.getEvent() == TouchEvent.UP)
                TestScreen.touchUp(this);
            else if(event.getEvent() == TouchEvent.DOWN)
                TestScreen.touchDown(this);
           return super.touchEvent(event);
        }
    
    
    }
    
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am developing app in Blackberry which have GPS Functionality. so first i want
I am currently writing an app on the Blackberry to do a simple send
I am trying my hands at developing my first screen for Blackberry with JDE4.2.1.
I have this first integration test for a tic tac toe game: [TestClass] public
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
i have two arrays like this first array Array ( [0228] => Array (
Using Dozer to map two objects, I have: /** /* This first class uses
#include <iostream> using namespace std; // This first class contains a vector and a
this my first shot at this awesome new (to me) programmers site, I hope
Code first: '''this is main structure of my program''' from twisted.web import http from

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.