-13

I am searching for a library or an algorithm to achieve the following functionality in Android:

enter image description here

I want to show letters on the screen; the user can select the letters by swiping over them to create a word.

I know this isn't really a programming question, but its related to programming and Android.

etienne
  • 3,146
  • 1
  • 24
  • 45
Worker123
  • 595
  • 4
  • 13
  • 32
  • 7
    "Questions asking us to **recommend or find a book, tool, software library, tutorial or other off-site resource** are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – F43nd1r Mar 29 '16 at 23:28
  • I assume you know programming android is based on java, so building algorithm I can help with some a primitive algorithm solution for you, but you need to implement the UI and the java code in your Android App, as if I also should do that it will be full project, and that is not the idea, let me know if I should processed. – Maytham Fahmi Mar 31 '16 at 22:46

1 Answers1

1

Here some advice you can use:

First for each cell you can create an object that represents the state of that cell:

class Cell {
   char mChar;
   int row,column;
   boolean isSelected;
}

then you can create a 2D array of your cells

Cell[][] mTable = ...

For views you have a lot of options:

for cells:

and for the viewgroup for your entire table you can choose any of the below:

For detecting swipe gesture set OnSwipeTouchListener(from which answers you like) as a TouchListener of your cell views. This listener gives callbacks on these events:

  • onSwipeRight()
  • onSwipeLeft()
  • onSwipeTop()
  • onSwipeBottom()

Game Architecture

You can use MVC architecture for this one. You need another class call it GameController. When you detect a swipe you have to pass it to the GameController with the index of that cell. GameController has to check if that swipe is valid or not for example diagonal swipe may not valid or... the rules are applied here. Then if the swipe is valid GameController updates the mTable(set isSelected to true for example) and then you have to update your ui from mTable data.

I think the whole idea is now a bit clearer to you, look forward to playing it :-)

Community
  • 1
  • 1