• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps I need help for my Assignment in university!!

Hroub

Lurker
Mar 28, 2015
4
2
Hello all members of this wonderful forum ..

I'm new here and I love this forum, and I want your help in solving

I'm studying computer science (fourth year),

our professor ask us to solve assignment 2 which requires

make a simple memory game, not necessary putting pictures on the buttons (Text enough) and it is not necessary to also put a Timer ..

3 days I'm working in it but to no avail, i'am put matrices and onclick, tried repeatedly but did not appear as a result

please help me :(:(

I'm sorry because of my poorly worded because I'm your friend from the Middle East of Jordan (Arabic)
 
Upvote 0
Ah, ok.
While I may know very little about developing an app, I moved your thread into our App Development forum, so other devs can possibly help.

Now, it may help to post what you did so far, perhaps post some code that you have already done:)

Saw this thread with some tools linked (in the sticky)
http://androidforums.com/threads/the-android-arsenal-libraries-tools-projects-for-devs.848625/

perhaps it may be of some help?


Thank you very much for your interest and help my friend

and These are some of my attempts :

Java:
public class MainActivity extends ActionBarActivity implements OnClickListener {


Button[] ListButton = new Button[13];
int[] ListText = new int[12];

int count=0;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    int[] ListText = {1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6};
    shuffleArray(ListText);


    ListButton[0] = (Button) findViewById(R.id.button0);
    ListButton[1] = (Button) findViewById(R.id.button1);
    ListButton[2] = (Button) findViewById(R.id.button2);
    ListButton[3] = (Button) findViewById(R.id.button3);
    ListButton[4] = (Button) findViewById(R.id.button4);
    ListButton[5] = (Button) findViewById(R.id.button5);
    ListButton[6] = (Button) findViewById(R.id.button6);
    ListButton[7] = (Button) findViewById(R.id.button7);
    ListButton[8] = (Button) findViewById(R.id.button8);
    ListButton[9] = (Button) findViewById(R.id.button9);
    ListButton[10] = (Button) findViewById(R.id.button10);
    ListButton[11] = (Button) findViewById(R.id.button11);
    ListButton[12] = (Button) findViewById(R.id.button12);

    ListButton[0].setOnClickListener(this);
    ListButton[1].setOnClickListener(this);
    ListButton[2].setOnClickListener(this);
    ListButton[3].setOnClickListener(this);
    ListButton[4].setOnClickListener(this);
    ListButton[5].setOnClickListener(this);
    ListButton[6].setOnClickListener(this);
    ListButton[7].setOnClickListener(this);
    ListButton[8].setOnClickListener(this);
    ListButton[9].setOnClickListener(this);
    ListButton[10].setOnClickListener(this);
    ListButton[11].setOnClickListener(this);
    ListButton[12].setOnClickListener(this);

}


    public void onClick(View v){

        ListButton[0].setText(String.valueOf(ListText[0]));
        ListButton[1].setText(String.valueOf(ListText[1]));
        ListButton[2].setText(String.valueOf(ListText[2]));
        ListButton[3].setText(String.valueOf(ListText[3]));
        ListButton[4].setText(String.valueOf(ListText[4]));
        ListButton[5].setText(String.valueOf(ListText[5]));
        ListButton[6].setText(String.valueOf(ListText[6]));
        ListButton[7].setText(String.valueOf(ListText[7]));
        ListButton[8].setText(String.valueOf(ListText[8]));
        ListButton[9].setText(String.valueOf(ListText[9]));
        ListButton[10].setText(String.valueOf(ListText[10]));
        ListButton[11].setText(String.valueOf(ListText[11]));



        for(int i=0 ; i<=12 ; i++) {


        switch(v.getId()) {

            case R.id.button0:
                if (ListButton[0].equals(ListButton[1])) {
                    count++;
                } else {
                    count++;
                    ListButton[0].setText(String.valueOf(""));
                    ListButton[i+1].setText(String.valueOf(""));
                }

            case R.id.button1:
                if (ListButton[1].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[1].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button2:
                if (ListButton[2].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[2].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button3:
                if (ListButton[3].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[3].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button4:
                if (ListButton[4].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[4].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button5:
                if (ListButton[5].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[5].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button6:
                if (ListButton[6].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[6].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button7:
                if (ListButton[7].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[7].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button8:
                if (ListButton[8].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[8].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button9:
                if (ListButton[9].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[9].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button10:
                if (ListButton[10].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[10].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button11:
                if (ListButton[11].getText() == ListButton[i].getText()) {
                    count++;
                } else {
                    count++;
                    ListButton[11].setText(String.valueOf(""));
                    ListButton[i].setText(String.valueOf(""));
                }

            case R.id.button12:

        }
        }


    }

Thank you again and I hope that it will help me
 
  • Like
Reactions: vosg and Mikestony
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones