Design Spinner Bottle Game With Source Code Step wise by using Android Studio and download this Spinner Bottle game app for Design First Open Android Studio .
A simple Bottle Spinner Game app For Entertainment nothing more nothing less. deepcrazyworld.com is an online learning.
deepcrazyworld is an online learning Platform with the help of various videos and blogs.
with free courses, all blogs are high demanded in today’s and explore your knowledge.
Search for deepcrazyworld.com in online with free .
1.Open Android Studio
2. Select Empty Project With min Sdk Version 15
3. Put This given XML Source Code for Designing Purpose .
4. Place This Given Main Activity code for Processing
5. Download Images For Spinner Bottle need Two Images Bottle And Surface Image
6. There is No Change in Manifest File .
7. After Download This Zip File , Than Require Unzip This File .
Download Images Click Here >>>>>>>>
Visit my Google Play Store Apps Click on this Link
Visit For Browser 5 G App On google Play Store>>>>>>>>>>
This My Creative App Click on DeepCrazyWorld App>>>>>>>>>>>
To Solve Your Math Calculation Math Solve App >>>>>
Spinner Bottle Game App>>>>>>>>>>>>>>>>>>>>>
This News Nation App News7on>>>>>>>>>>>>>>
Shopping App ZampKart >>>>>>>>>>>>>>>>>>>
Math Equation Solving App>>>>>>>>>>>>>>>>>>>
Event Basis Picture LovingCaring143 App>>>>>>>>>
Here This Blogger Site App to Explore Your Knowledge Download all this Apps By Google Play Store My Blogger Site App Download And InstallParagraph
Click on Link CrazyCoder>>>>>>>>>>
Flying Fish Video Game Visit Here >>>>>>
Download Complete Project Click Here >>>>>
8. Run The Project .
build.gradle
apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "com.deep.spinnerbottle" minSdkVersion 15 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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="@drawable/flor" tools:context=".MainActivity"> <ImageView android:id="@+id/bottle" android:layout_width="300dp" android:layout_height="300dp" android:src="@drawable/mybottle" android:layout_centerInParent="true" android:onClick="spinBottle"/> </RelativeLayout>
MainActivity.java
package com.deep.spinnerbottle; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.widget.ImageView; import androidx.appcompat.app.AppCompatActivity; import java.util.Random; public class MainActivity extends AppCompatActivity { private ImageView bottle; private Random random = new Random(); private int lastDir; private boolean spinning; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bottle = findViewById(R.id.bottle); } public void spinBottle(View v) { if (!spinning) { int newDir = random.nextInt(1800); float pivotX = bottle.getWidth() / 2; float pivotY = bottle.getHeight() / 2; Animation rotate = new RotateAnimation(lastDir, newDir, pivotX, pivotY); rotate.setDuration(2500); rotate.setFillAfter(true); rotate.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { spinning = true; } @Override public void onAnimationEnd(Animation animation) { spinning = false; } @Override public void onAnimationRepeat(Animation animation) { } }); lastDir = newDir; bottle.startAnimation(rotate); } } }
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.deep.spinnerbottle"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>