This is a very simple card memory game I wrote for Android platform.
I’ve attached it complete with source code and resources.
Enjoy.
Screen shots:



This is a very simple card memory game I wrote for Android platform.
I’ve attached it complete with source code and resources.
Enjoy.



androidmenifest.xml is missing in source code
Are you sure?
I have just download the source code and saw it.
Please check again.
If there is still a problem, leave me your email and I will send it to you.
Hi,
I tried to download a source code and build the game but it gives
the same error. Can you please email me zipped folder ?
Thanks,
Mitu
Hi, i downloaded this source code but it is showing some errors in Manager.java file,
I am a fresher to android gaming apps.
please send me the executable source code of this application, It will help me a lot.
Hi Jinka,
What do you mean by “executable” source code?
Hi, Thanks for posting this game code. This was really helpful. I was trying to add some more functionality to this code like show all cards by clicking a button, so I was wondering if you could help me with that.
I am very new to programming so your help will be highly appreciated.
Thanks in advance!
thank you very much! it is really helpful in doing my game development home work
thank you very much!
thank you very much! it is really helpful in doing my game development.
Hi…I’m new to JAVA for Android…
For my sch project, i decided to do a memory game.
i have decided to use ur source code..however, there is no error but when i run it in sdk-android, the game force close..
plz help !!!
hi i was looking at this code, pretty good , really really good, ive been peeking and poking it , and was wondering how would one make the pictures have certain space on the phone, what i mean is , having them cover all the screen of the phone in land and port mode, having them separated by certain amount of space
There was an error on ArrayAdapter statement and import java.util.regex.Pattern;
Could you help me please? Thx!
Hi rizky,
java.util.regex.Pattern is a standard import, there shouldn’t be a problem with it- try cleaning your project.
Send me the error message of the ArrayAdapter .
The error message: ArrayAdapter is a raw type. References to generic type ArrayAdapter should be parameterized
What should i do?
Thank you !! it’s very usefull !!
However i have one question about your “Manager.java” :
In which part of the code, do you duplicate the different image ??
thx again
I am not sure I understood the question but i’ll try to help.
in loadCards() I create a list of sorted numbers according to the number of the cards.
Than I pull them one by one in random order and order them in a matrix according to the cards on the table
but first I divide the number by 2 so that each 2 cards on the table will hold the number.
Now look at the function turnCard() – when a user click on a card I take the image
according to the number it holds. This is how 2 cards on the table hold the same image.
Does that answer your question?
Yes it’s perfect !!!
Thx you very much
I have an other question,
If i want to change this line : if(cards[seconedCard.x][seconedCard.y] == cards[firstCard.x][firstCard.y]){ …
by on other which chek if, for example, an apple and a banana are found on the same turn, and then those cards become invisible … How should i do ?
Maybe : if(cards[seconedCard.x][seconedCard.y] == R.drawable.card1 && cards[firstCard.x][firstCard.y] == R.drawable.card2) { …
or something like that ??
I hope that it’s rather understandable !
Thx
Great sample! I am modifying this to have some pics my son likes, but I noticed an issue with large resolution screens. In Droid phones it works great, but on my 2.2 pad if you empty a row of cards via matching, the layout shrinks and new cards you turn over are resized…basically, smashed. I can rework the code to use fixed sized containers for each card/cell, but I’d rather not if you already saw it and resolved it. Again, thanks for this code, it is a great way to start customizing my own similar game.
wow.. you are very good.. thank you.
It really helped me in learning
Sir,
The code have some error please tell me what can i do?
Hi ranjeet,
What is the error?
There are some errors:
1. The method onClick(View) of type Manager.ButtonListener must override a superclass method
2. The method onItemSelected(AdapterView, View, int, long) of type new AdapterView.OnItemSelectedListener(){} must override a superclass method
3. The method onNothingSelected(AdapterView) of type new AdapterView.OnItemSelectedListener(){} must override a superclass method
Hi lones,
I have just downloaded the project and imported it into my eclipse.
It compiles and run as it should.
Here’s a suggestion, try cleaning your project in eclipse, see if that’s help.
Also, make sure you havent got any environment related problems.
Do you have problems with some of the imports?
Hi
Thanks for your source code, but I have a problem when I next started eclipse..
I have a problem with arrayAdapter, eclipse give me two option
1. Create field “array” in R tipe
2. Create constant “array” in R tipe
What I have todo…?
Thanks again..
Ignore the suggestions from eclipse, they are not good.
Make sure you have added all the files from my project (including all the files under the ‘res’ folder).
Try cleaning the project in eclipse.
Is that helps?
thx alot
very helpful
Hey. Thanks for the code!
It works perfectly fine. But can you explain me why do you use “log” in your program? I don’t understand what it is used for. Also suggest me links where I can find material to read about it.
Log is a tool for developers to print messages and parameters values while the program is running.
Let’s say for example you would like to see the value of parameter X in diffrent times of the program, than you can use the Log to print it’s value in diffrent times.
The log is also used to print errors.
All the messages are displayed in the log cat console.
http://developer.android.com/guide/developing/debugging/debugging-log.html
http://developer.android.com/reference/android/util/Log.html
Don’t know why I can’t compile it back to the apk file. At first blush exerything seems to be ok but is not. File has been compiled but is not working on my HTC… Could you please help me?
thaxx a lot…now i will be copying it for my collg project…mmuuaahhh
Thanks Man !!
hey
i got the same problem with arrayAdapter.. how can i fix it? any suggestions?
Hi,
You have done excellent job. Very nice. Though I tried to build it but it did not build.
Could you please give the working source code