{"id":26751563,"url":"https://github.com/sayed3li97/magic8ball-android","last_synced_at":"2025-03-28T12:18:39.060Z","repository":{"id":198676338,"uuid":"168053348","full_name":"sayed3li97/Magic8Ball-Android","owner":"sayed3li97","description":"Simple Android Magic 8 Ball app. One Activity that displays a random prediction to answer the user question. The App randomly choose an answer from an array and display it to the user when the user clicks on the text in the middle of the screen.","archived":false,"fork":false,"pushed_at":"2021-12-10T11:03:21.000Z","size":225,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-10-06T11:41:45.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sayed3li97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-28T23:12:06.000Z","updated_at":"2023-10-06T11:41:47.329Z","dependencies_parsed_at":null,"dependency_job_id":"d7c5e20e-4cad-49dc-bbef-740ae6db1c13","html_url":"https://github.com/sayed3li97/Magic8Ball-Android","commit_stats":null,"previous_names":["sayed3li97/magic8ball-android"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FMagic8Ball-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FMagic8Ball-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FMagic8Ball-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FMagic8Ball-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayed3li97","download_url":"https://codeload.github.com/sayed3li97/Magic8Ball-Android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246026095,"owners_count":20711581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-28T12:18:37.828Z","updated_at":"2025-03-28T12:18:38.800Z","avatar_url":"https://github.com/sayed3li97.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magic8Ball\nSimple Android Magic 8 Ball app. One Activity displays a random prediction to answer the user question. The App randomly chooses an answer from an array and shows it to the user when they click on the text in the middle of the screen.\n\n# Screenshots \n\u003cimg src=\"/screenshots/screenshot1.png\" width=\"220\" height=\"400\"\u003e \u003cimg src=\"/screenshots/screenshot2.png\" width=\"220\" height=\"400\"\u003e \n\u003cimg src=\"/screenshots/screenshot3.png\" width=\"220\" height=\"400\"\u003e \n\n# Step to re-create \n1. Create a new project in Android Studio (Choose the Empty Activity)\n2. Navigate to app/res/layout/activity_main.xml\n3. Open the \"TextView\" and replace the XML code with the below code \n```\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003candroid.support.constraint.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".MainActivity\"\u003e\n\n    \u003cTextView\n        android:id=\"@+id/textView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Ask? (Click)\"\n        android:textColor=\"@android:color/black\"\n        android:textSize=\"30sp\"\n        android:textStyle=\"bold\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintLeft_toLeftOf=\"parent\"\n        app:layout_constraintRight_toRightOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" /\u003e\n\n\u003c/android.support.constraint.ConstraintLayout\u003e\n```\n\n4. Open the java file for the main Activity by opening the MainActivity.java from the following path app/java/\"The first folder\"/MainActivity.java\n5. Replace the code in that file with the below code (\"Don't remove the first line starting with the package\")\n\n```\n\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.TextView;\n\nimport org.w3c.dom.Text;\n\nimport java.util.Random;\n\npublic class MainActivity extends AppCompatActivity  {\n\n    //Declare the variable that will display and invoke the predictions\n    TextView textView;\n    //String array that will store a list of predictions\n    String[] predictions;\n    // Random object to choose from the list\n    Random random;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        //specify the string array size\n        predictions = new String[20];\n\n        //Add all the predictions value\n        predictions[0] = \"It is certain\";\n        predictions[1] = \"It is decidedly so\";\n        predictions[2] = \"Without a doubt\";\n        predictions[3] = \"Yes - definitely\";\n        predictions[4] = \"You may rely on it\";\n        predictions[5] = \"As I see it, yes\";\n        predictions[6] = \"Most likely\";\n        predictions[7] = \"Outlook good\";\n        predictions[8] = \"Yes\";\n        predictions[9] = \"Signs point to yes\";\n        predictions[10] = \"Reply hazy, try again\";\n        predictions[11] = \"Ask again later\";\n        predictions[12] = \"Better not tell you now\";\n        predictions[13] = \"Cannot predict now\";\n        predictions[14] = \"Concentrate and ask again\";\n        predictions[15] = \"Don't count on it\";\n        predictions[16] = \"My reply is no\";\n        predictions[17] = \"My sources say no\";\n        predictions[18] = \"Outlook not so good\";\n        predictions[19] = \"Very doubtful\";\n\n        // Create new Random object to be used to predict\n        random = new Random();\n\n        //Connect the textView variable with the layout element\n        textView = (TextView) findViewById(R.id.textView);\n\n        //When the text view is clicked it will run the code inside\n        textView.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                //Choose a random prediction and display it on the text view\n                textView.setText(predictions[random.nextInt(20)]);\n            }\n        });\n\n\n    }\n}\n\n```\nThank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayed3li97%2Fmagic8ball-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayed3li97%2Fmagic8ball-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayed3li97%2Fmagic8ball-android/lists"}