Android Studio Calculating and parsing - JAVA - XML ​​CODE

Arah Lab
0

 



Calculating and parsing - JAVA CODE
Android Studio Java Code Box with Copy Button
     
 package com.nahid.class229;
 import androidx.appcompat.app.AppCompatActivity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
 import com.google.android.material.textfield.TextInputEditText;
 public class MainActivity extends AppCompatActivity {
 Button Button;
 TextView TVDisplay;
 TextInputEditText Ed1, Ed2;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 Button = findViewById(R.id.Button);
 TVDisplay = findViewById(R.id.TVDisplay);
 Ed1 = findViewById(R.id.Ed1);
 Ed2 = findViewById(R.id.Ed2);
 Button.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 String Jobayer1 = Ed1.getText().toString();
 String Jobayer2 = Ed2.getText().toString();
 if (Jobayer1.isEmpty()){
 Ed1.setError("Enter Number");
 }else if (Jobayer2.isEmpty()){
 Ed2.setError("Enter Number");
 }else {
 int Eb1 = Integer.parseInt(Jobayer1);
 int Eb2 = Integer.parseInt(Jobayer2);
 for (int J=Eb1; J<=Eb2; J++){
 ========================== Jor =======================
 if (J%2==0) TVDisplay.append(" "+J);
 =================================================================
 ========================= Bijor ============================
 if (J%1==1) TVDisplay.append(" "+J);
 ====================================================
 ==================== Gonna =======================
 TVDisplay.append(" "+J);
 ====================================================
         }
       }
     }
 
  });
 
 }
}



        


  Calculating and parsing - XML CODE
Android Studio Java Code Box with Copy Button


<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=".Homework_Jor"
    android:orientation="vertical"
    android:background="#E4EEED"
    >

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar2"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@drawable/bottom_curved"
        app:title="গণনা / জোড় / বিজোড় বের করুন"
        android:elevation="4dp"
        app:titleTextColor="@color/white"
        />

    <LinearLayout
        android:id="@+id/Hello1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_marginTop="60dp"
        >


        <LinearLayout
            android:id="@+id/Layout3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:visibility="visible"
            >


            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/FBS1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                app:errorTextColor="#FF0000"
                app:hintTextColor="#0038FF"
                android:hint="কত থেকে সংখ্যা দেখতে চান?"
                app:boxStrokeColor="#000DFF"
                android:textColorHint="#18851D"
                app:endIconMode="clear_text"
                app:endIconTint="#FF0000"
                >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/EdTexg1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="numberDecimal"
                    android:textColor="@color/black"
                    />


            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/FBS2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                app:errorTextColor="#FF0000"
                app:hintTextColor="#0038FF"
                android:hint="কত পর্যন্ত সংখ্যা দেখতে চান?"
                app:boxStrokeColor="#000DFF"
                android:textColorHint="#18851D"
                app:endIconMode="clear_text"
                app:endIconTint="#FF0000"
                >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/EdTexg2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="numberDecimal"
                    android:textColor="@color/black"
                    />


            </com.google.android.material.textfield.TextInputLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:weightSum="2"
                android:layout_marginTop="10dp"
                >

                <Button
                    android:id="@+id/Buttong1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:backgroundTint="#18851D"
                    android:text="Click Here"
                    android:textColor="#FFFFFF"
                    android:textSize="20sp"
                    android:layout_weight="1"
                    android:layout_marginRight="110dp"
                    android:layout_marginLeft="110dp"
                    />




            </LinearLayout>


            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="380dp"
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_margin="20dp"
                    android:layout_marginBottom="55dp"
                    >

                    <TextView
                        android:id="@+id/TVDisplayg1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="25sp"
                        android:textColor="#18851D"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:layout_marginBottom="10dp"
                        android:visibility="gone"
                        />

                    <com.airbnb.lottie.LottieAnimationView
                        android:id="@+id/AnimisonLotti1"
                        android:layout_width="match_parent"
                        android:layout_height="400dp"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintHorizontal_bias="0.498"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        android:layout_gravity="center"
                        app:lottie_autoPlay="true"
                        app:lottie_loop="true"
                        app:lottie_rawRes="@raw/search"
                        android:visibility="visible"
                        />


                </LinearLayout>

            </ScrollView>



        </LinearLayout>


        <LinearLayout
            android:id="@+id/Layout1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:visibility="gone"
            >


            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/FBS3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                app:errorTextColor="#FF0000"
                app:hintTextColor="#0038FF"
                android:hint="কত থেকে বিজোড় সংখ্যা দেখতে চান?"
                app:boxStrokeColor="#000DFF"
                android:textColorHint="#FF5722"
                app:endIconMode="clear_text"
                app:endIconTint="#FF0000"
                >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/EdText1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="numberDecimal"
                    android:textColor="@color/black"
                    />


            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/FBS4"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                app:errorTextColor="#FF0000"
                app:hintTextColor="#0038FF"
                android:hint="কত পর্যন্ত বিজোড় সংখ্যা দেখতে চান?"
                app:boxStrokeColor="#000DFF"
                android:textColorHint="#FF5722"
                app:endIconMode="clear_text"
                app:endIconTint="#FF0000"
                >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/EdText2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="numberDecimal"
                    android:textColor="@color/black"
                    />


            </com.google.android.material.textfield.TextInputLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:weightSum="2"
                android:layout_marginTop="10dp"
                >

                <Button
                    android:id="@+id/Buttont1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:backgroundTint="#FF5722"
                    android:text="Click Here"
                    android:textColor="#FFFFFF"
                    android:textSize="20sp"
                    android:layout_weight="1"
                    android:layout_marginRight="110dp"
                    android:layout_marginLeft="110dp"
                    />




            </LinearLayout>


            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="380dp"
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_margin="20dp"
                    android:layout_marginBottom="55dp"
                    >

                    <TextView
                        android:id="@+id/TVDisplayt1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="25sp"
                        android:textColor="#FF5722"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:layout_marginBottom="10dp"
                        android:visibility="gone"
                        />


                    <com.airbnb.lottie.LottieAnimationView
                        android:id="@+id/AnimisonLotti2"
                        android:layout_width="match_parent"
                        android:layout_height="400dp"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintHorizontal_bias="0.498"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        android:layout_gravity="center"
                        app:lottie_autoPlay="true"
                        app:lottie_loop="true"
                        app:lottie_rawRes="@raw/search"
                        android:visibility="visible"
                        />


                </LinearLayout>

            </ScrollView>



        </LinearLayout>


        <LinearLayout
            android:id="@+id/Layout2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:visibility="gone"
            >


            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/FBS5"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                app:errorTextColor="#FF0000"
                app:hintTextColor="#0038FF"
                android:hint="কত থেকে জোড় সংখ্যা দেখতে চান?"
                app:boxStrokeColor="#000DFF"
                android:textColorHint="#3F51B5"
                app:endIconMode="clear_text"
                app:endIconTint="#FF0000"
                >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/EdTex1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="numberDecimal"
                    android:textColor="@color/black"
                    />


           </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/FBS6"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                app:errorTextColor="#FF0000"
                app:hintTextColor="#0038FF"
                android:hint="কত পর্যন্ত জোড় সংখ্যা দেখতে চান?"
                app:boxStrokeColor="#000DFF"
                android:textColorHint="#3F51B5"
                app:endIconMode="clear_text"
                app:endIconTint="#FF0000"
                >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/EdTex2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="numberDecimal"
                    android:textColor="@color/black"
                    />


            </com.google.android.material.textfield.TextInputLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:weightSum="2"
                android:layout_marginTop="10dp"
                >

                <Button
                    android:id="@+id/Button1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:backgroundTint="#3F51B5"
                    android:text="Click Here"
                    android:textColor="#FFFFFF"
                    android:textSize="20sp"
                    android:layout_weight="1"
                    android:layout_marginRight="110dp"
                    android:layout_marginLeft="110dp"
                    />




            </LinearLayout>


            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="380dp"
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_margin="20dp"
                    >

                    <TextView
                        android:id="@+id/TVDisplay1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="25sp"
                        android:textColor="#3F51B5"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:layout_marginBottom="10dp"
                        android:visibility="gone"
                        />


                    <com.airbnb.lottie.LottieAnimationView
                        android:id="@+id/AnimisonLotti3"
                        android:layout_width="match_parent"
                        android:layout_height="400dp"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintHorizontal_bias="0.498"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        android:layout_gravity="center"
                        app:lottie_autoPlay="true"
                        app:lottie_loop="true"
                        app:lottie_rawRes="@raw/search"
                        android:visibility="visible"
                        />


                </LinearLayout>

            </ScrollView>



        </LinearLayout>



    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:orientation="horizontal"
        android:weightSum="3"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_alignBottom="@id/Hello1"
        >



        <Button
            android:id="@+id/ButtonLayout3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textColor="@color/white"
            android:text="গণনা"
            android:backgroundTint="#18851D"
            android:layout_weight="1"
            android:layout_marginRight="15dp"
            />


        <Button
            android:id="@+id/ButtonLayout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textColor="@color/white"
            android:text="জোড়"
            android:backgroundTint="#0763AC"
            android:layout_weight="1"
            android:layout_marginRight="10dp"
            android:layout_marginLeft="5dp"
            />

        <Button
            android:id="@+id/ButtonLayout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:textColor="@color/white"
            android:text="বিজোড়"
            android:backgroundTint="#FF5722"
            android:layout_weight="1"
            android:layout_marginLeft="10dp"
            />



    </LinearLayout>



</RelativeLayout>

        



Post a Comment

0Comments

Post a Comment (0)