package com.example.moag;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.TextView;
public class openGoldFish extends AppCompatActivity {
private static final int GRID_SIZE = 40;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_open_gold_fish);
GridLayout gridLayout = findViewById(R.id.gridLayout);
// used to get size of each tile by getting size of screen
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int slotWidth = screenWidth / 5; // 5 cols
int slotHeight = slotWidth;
for (int i = 1; i <= GRID_SIZE; i++) {
// puts fish on each tile
TextView slot = new TextView(this);
slot.setBackgroundResource(R.drawable.tileback_94); // background
// size of each slot
GridLayout.LayoutParams params = new GridLayout.LayoutParams();
params.width = slotWidth;
params.height = slotHeight;
slot.setLayoutParams(params);
// Add the slot to the GridLayout
gridLayout.addView(slot);
}
}
}```
#Need Help Making Memory Game on Android Studio
1 messages · Page 1 of 1 (latest)
Detected code, here are some useful tools:
Formatted code
package com.example.moag;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.TextView;
public class openGoldFish extends AppCompatActivity {
private static final int GRID_SIZE = 40;
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.activity_open_gold_fish);
GridLayout gridLayout = findViewById(R.id.gridLayout);
// used to get size of each tile by getting size of screen
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int slotWidth = screenWidth / 5;
// 5 cols
int slotHeight = slotWidth;
for (int i = 1; i <= GRID_SIZE; i++) {
// puts fish on each tile
TextView slot = new TextView(this );
slot.setBackgroundResource(R.drawable.tileback_94);
// background
// size of each slot
GridLayout.LayoutParams params = new GridLayout.LayoutParams();
params.width = slotWidth;
params.height = slotHeight;
slot.setLayoutParams(params);
// Add the slot to the GridLayout
gridLayout.addView(slot);
}
}
}
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".openGoldFish">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_margin="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gridLayout"
android:rowCount="8"
android:columnCount="5"
android:layout_margin="2dp"
android:background="@drawable/tile_background"
/>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>```
I currently just have a grid of 40 tiles.
I need to make them flip when I click on them
and when they are flipped they should have a picture that is stored inside my res folder
can anyone give me any help?
Changed the category to Android.
<@&987246623988019200> please have a look, thanks.
@slate wave
Please don't ask to ask, nor only say hello, just ask your actual question right away, thanks 
If you want to read about the details of why this is better, check out:
https://dontasktoask.com/
zabuzard • used /tag id: ask reply-to: @rich
·
i didnt? i asked my questions?
really?
i put the whole thing it must have not shown for some reason
are you guys able to see this image?
ill put the rest but i wanna see if maybe theres some kind of glitch or something
this is my xml ```xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".openGoldFish">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_margin="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gridLayout"
android:rowCount="8"
android:columnCount="5"
android:layout_margin="2dp"
android:background="@drawable/tile_background"
/>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>```
Detected code, here are some useful tools:
Formatted code
< ? xml version = "1.0"encoding = "utf-8" ? > < androidx.constraintlayout.widget.ConstraintLayout xmlns : android = "http://schemas.android.com/apk/res/android"xmlns : app = "http://schemas.android.com/apk/res-auto"xmlns : tools = "http://schemas.android.com/tools"android : layout_width = "match_parent"android : layout_height = "match_parent"android : background = "#000000"tools : context = ".openGoldFish" > < ScrollView android : layout_width = "match_parent"android : layout_height = "match_parent"android : fillViewport = "true"android : layout_margin = "8dp"app : layout_constraintTop_toTopOf = "parent"app : layout_constraintStart_toStartOf = "parent"app : layout_constraintEnd_toEndOf = "parent"app : layout_constraintBottom_toBottomOf = "parent" > < LinearLayout android : layout_width = "match_parent"android : layout_height = "wrap_content"android : orientation = "vertical" > < GridLayout android : layout_width = "match_parent"android : layout_height = "wrap_content"android : id = "@+id/gridLayout"android : rowCount = "8"android : columnCount = "5"android : layout_margin = "2dp"android : background = "@drawable/tile_background" / > < / LinearLayout > < / ScrollView > < / androidx.constraintlayout.widget.ConstraintLayout >
what I wanna do is make a memory game so when you click on a tile it would flip and give u the image on the other side but i got no idea how to do that
or if i can even use gridview as somebody said i needed to use imageview
'Need help' or 'I want to make this' is a difficult thing to give an answer to
That is why fa285634 said that there was no question
We're not here to be a step by step guide to make something, we're here to help you if you have a specific question, or if you are stuck on a specific problem
Ok so I have the back of the cards at the moment
I would like to know how to add a image on the back of that tile
i just saw your message sorry
Closed the thread due to inactivity.
If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍
is anyone able to help me in adding an image on the back of the tile?
do people only reply to these to tell people they done something wrong or do we get help as well?
Very few people know android stuff
yes. that mention was already executed
u pinged all android helpers on this server already
now make ur thread more accessible to them, so that they stop just clicking it away again
Closed the thread due to inactivity.
If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍