Monthly Archives: August 2020

Code Tutorial #004 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:id=”@+id/layout” tools:context=”.MainActivity”> <ImageView android:id=”@+id/disk_view” android:layout_width=”48dp” android:layout_height=”48dp” android:layout_marginTop=”20dp” android:layout_centerHorizontal=”true” app:srcCompat=”@drawable/disk” /> <ImageView android:id=”@+id/ground_view” android:layout_width=”match_parent” android:layout_height=”40dp” android:layout_alignParentBottom=”true” app:srcCompat=”@drawable/ground” /> </RelativeLayout> MainActivity.java: import androidx.appcompat.app.AppCompatActivity; import android.animation.Animator; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.view.ViewPropertyAnimator; import android.view.animation.AccelerateInterpolator; import android.view.animation.BounceInterpolator; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { ImageView mDisk, mGround; MediaPlayer mp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);…

Read more

Code Tutorial #003 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:id=”@+id/layout” tools:context=”.MainActivity”> <ImageView android:id=”@+id/disk_view” android:layout_width=”48dp” android:layout_height=”48dp” android:layout_marginTop=”20dp” android:layout_centerHorizontal=”true” app:srcCompat=”@drawable/disk” /> <ImageView android:id=”@+id/ground_view” android:layout_width=”match_parent” android:layout_height=”40dp” android:layout_alignParentBottom=”true” app:srcCompat=”@drawable/ground” /> </RelativeLayout>   MainActivity.java: import androidx.appcompat.app.AppCompatActivity;import android.animation.Animator;import android.media.MediaPlayer;import android.os.Bundle;import android.util.DisplayMetrics;import android.view.View;import android.view.ViewPropertyAnimator;import android.view.animation.AccelerateInterpolator;import android.view.animation.BounceInterpolator;import android.widget.ImageView;import android.widget.RelativeLayout;import android.widget.Toast;public class MainActivity extends AppCompatActivity { ImageView mDisk, mGround; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mGround = findViewById(R.id.ground_view); mDisk = findViewById(R.id.disk_view); mDisk.setOnClickListener(new View.OnClickListener() {…

Read more

Code Tutorial #001 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” tools:context=”.MainActivity”> <TextView android:id=”@+id/counting_view” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:textSize=”30sp” android:text=”0″ android:layout_centerInParent=”true”/> <EditText android:id=”@+id/number_change” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_below=”@+id/counting_view” android:layout_marginTop=”50dp” android:ems=”10″ android:inputType=”number” android:gravity=”center” android:hint=”0″/> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:id=”@+id/btn_add” android:text=”ADD” android:layout_below=”@+id/number_change” android:layout_centerHorizontal=”true” android:layout_marginTop=”20dp”/></RelativeLayout>   MainActivity.java: import androidx.appcompat.app.AppCompatActivity;import android.animation.ValueAnimator;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.TextView;public class MainActivity extends AppCompatActivity { Button btnAdd; TextView countinView; EditText numberChange; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnAdd =…

Read more

Code Tutorial #002 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” tools:context=”.MainActivity”> <ImageButton android:layout_width=”130dp” android:layout_height=”130dp” android:id=”@+id/btn_pic” android:src=”@drawable/ic_launcher_foreground” android:layout_centerInParent=”true”/> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”save” android:layout_centerHorizontal=”true” android:layout_below=”@+id/btn_pic” android:id=”@+id/btn_save”/> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”load” android:layout_centerHorizontal=”true” android:layout_below=”@+id/btn_save” android:id=”@+id/btn_load”/> </RelativeLayout> MainActivity.java: import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import android.Manifest; import android.app.Activity; import android.content.ContextWrapper; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.Toast;…

Read more

4/4