Requirement ? Use Android Studio. ? To submit, package your work in Eclipse proj
ID: 3917861 • Letter: R
Question
Requirement ? Use Android Studio. ? To submit, package your work in Eclipse project with ZIP format
Project: Card Game
This project involves writing a basic game app that allows the player given three cards to guess which one is the red card. The three cards are composed of two black and one red cards. Generally, the app shuffles and serves the cards on face-down as shown below. The app should have a means to start a new game. It could be a “Start” button.
The player picks the card by clicking the “Left”, “Center”, or “Right” button. For instance, if the player picks the left card while the red card is on the right, the player losses.
Explanation / Answer
MainActivity.java package com.example.jigyasagyanani.cardgame; import android.content.Intent; import android.media.Image; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { ImageView i1,i2,i3,i4,i5,i6; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); i1=(ImageView)findViewById(R.id.i1); i2=(ImageView)findViewById(R.id.i2); i3=(ImageView)findViewById(R.id.i3); i4=(ImageView)findViewById(R.id.i4); i5=(ImageView)findViewById(R.id.i5); i6=(ImageView)findViewById(R.id.i6); } public void left(View v) { i1.setVisibility(View.GONE); i2.setVisibility(View.VISIBLE); } public void center(View v) { i3.setVisibility(View.GONE); i4.setVisibility(View.VISIBLE); } public void right(View v) { i5.setVisibility(View.GONE); i6.setVisibility(View.VISIBLE); } } First.java package com.example.jigyasagyanani.cardgame; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; /** * Created by jigyasagyanani on 7/26/2018. */ public class First extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.first); } public void start(View v) { Intent i=new Intent(First.this,MainActivity.class); startActivity(i); } } now xml files activity_main.xml first.xml AndroidManifest.xml its 100 percent working code .dont forget to give thumbsup just add card1,card2,card3 ,card.png of your choice in mipmap folder . you will get desired resultRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.