Blog Feed

Privacy Policy For AlarmPm

Anon3mity built the [AlarmPm] app as a Free app. This SERVICE is provided by Anon3mity at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at [AlarmPm] unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information, including but not limited to none. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third party services that may collect information used to identify you.

Link to privacy policy of third party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device’s internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at [dev.anon3mity@gmail.com].

Privacy Policy

Tic Tac Go

Anon3mity built the [Tic Tac Go] app as a Free app. This SERVICE is provided by Anon3mity at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at [Tic Tac Go] unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third party services that may collect information used to identify you.

Link to privacy policy of third party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device’s internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at [137unknown@gmail.com].

This privacy policy page was created at privacypolicytemplate.net and modified/generated by App Privacy Policy Generator

Firebase Cloud Firestore Android Studio

Hey cod3re’s today in this example we will learn about firebase cloud firestore

What is Firebase.

firebase is a set of tools for development by google and offers variety of other feature to improve performance and speed as well as some other essential tools for building a production level app.

Firebase has 3 different  plan’s and one of them is free with some basic features.

Link’s

subscribe=>


So without wasting your time let’s get straight into it..

Tutorial level

Rating: 2 out of 5.

To Add Firebase into your project you need to connect firebase assistant to your project for that you need to to go into tool>firebase open assistant and find firestore after select firebase cloud firestore click into connect your app option and then follow along after adding all the necessary implication we will add two edittext into our Main Activity.xml

make sure to set the layout to linearlayout then add a button into .Xml assign all widgets to there corresponding id’s

MainActivity.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:padding="16dp"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/name_editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Enter name"
        android:inputType="text"
        />

    <EditText
        android:id="@+id/pass_editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Password"
        android:inputType="number"
        />
    <Button
        android:id="@+id/save_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Save DAta"
        android:onClick="saveNote"
        android:layout_gravity="center_horizontal"
        />



</LinearLayout>

after completing our mainactivity.xml we will jump into our MainActivity.java file.

MainActivity.java

package com.anon3mity.firebaseexample;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.firestore.FirebaseFirestore;

import java.util.HashMap;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";
    private static final String KEY_NAME ="name";
    private static final String KEY_PASSWORD ="pass";

    private EditText editTextname;
    private EditText editTextpass;

    private FirebaseFirestore db = FirebaseFirestore.getInstance();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        editTextname =(EditText)findViewById(R.id.name_editText);
        editTextpass =(EditText)findViewById(R.id.pass_editText);

    }

    public void saveNote(View v){
        String name = editTextname.getText().toString();
        String pass = editTextpass.getText().toString();

        Map<String, Object> note = new HashMap<>();
        note.put(KEY_NAME, name);
        note.put(KEY_PASSWORD, pass);

        db.collection("Notebook").document("My First Note").set(note)
                .addOnSuccessListener(new OnSuccessListener<Void>() {
                    @Override
                    public void onSuccess(Void aVoid) {
                            Toast.makeText(MainActivity.this,"success data passed",Toast.LENGTH_LONG).show();
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Toast.makeText(MainActivity.this,"error!",Toast.LENGTH_LONG).show();
                        Log.d(TAG,e.toString());

                    }
                });


    }
}

Firebase save our data into a form of collection and each collection’s contain other collection’s and we can pass our data in firebase throw android studio using the firebase auth class and firebase accept data in a tag and value format so for that we have to create HashMap<> for our data as you can see in above code.

that’s all for today cod3r’s i hope you understand how to use firebase firestore. and if you have any query about this example make sure to hit a comment..

Shape Drawable Button .Xml Android Studio

Hello cod3r’s i have prepared an example of Custom_Button with the help of .xml file’s

To help you understand shape drawable

What is shape drawable*

Shape drawable is nothing more just a collection of .xml file’s with that

you can create your own awesome Custom_Button as well as you can

create more with that.

Let’s Get Into Code!

Tutorial Level

Rating: 3 out of 5.

Subscribe us for more tutorial’s LIKE THIS..

first of all after gradle sync

we need to create a new resource file so for that we will go intro res > drawable then we will right click on the drawable folder and pick a new resources file from the new section the first option on the popup menu. as you can see below.

we will name this file as our button_default then we hit ok after that we will have our first button_default.xml file so for this example we’ill need three .xml file’s but as for now we will work on this .xml file i will tell you more as we go further in this tutorial.

button_default.xml

first we change the default attribute to shape and give it another attribute android:shape=”rectangle”> and then we add another attribute <gradient in this we give end color and start color

android:startColor="#0000ff"
android:endColor="#fff"

for our gradient effect then we give some padding and a stroke,Corner’s as you can see below

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >
    <gradient
        android:startColor="#0000ff"
        android:endColor="#fff"
        />
        <padding
            android:bottom="7dp"
            android:top="7dp"
            android:right="7dp"
            android:left="7dp"/>
    <stroke
        android:width="2dp"
        android:color="#9C27B0"/>

    <corners android:radius="15dp"/>

</shape>

after completing our default_button.xml we copy all the codes for our two other .Xml file’s as i mentioned above so we go to our drawable folder again and create another resource file as button_disabled and we paste our code in it. then simply we change our color’s to gray as you can see below (for creating a disabled effect).

button_disabled.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >


    <solid
        android:color="#b6b7b5"
        />

        <padding
            android:bottom="7dp"
            android:top="7dp"
            android:right="7dp"
            android:left="7dp"/>
    <stroke
        android:width="2dp"
        android:color="#9C27B0"/>

    <corners android:radius="15dp"/>
    


</shape>

After that we create our 3rd resource file button_pressed.xml and again pase all code as we did earlier in the button_disabled.xml and just change the gradient color for a
(pressed effect).

android:startColor="#03A9F4"
android:endColor="#fff"

button_pressed.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    >


    <gradient
        android:startColor="#03A9F4"
        android:endColor="#fff"
        />

        <padding
            android:bottom="7dp"
            android:top="7dp"
            android:right="7dp"
            android:left="7dp"/>
    <stroke
        android:width="2dp"
        android:color="#9C27B0"/>

    <corners android:radius="15dp"/>


</shape>

We have successfully created our all resources file for our shape drawable and now we have to attached all the resources file to a single .xml file for we can call it in our project

we give it a name custom_button

custom_button.xml

in this xml we dont change the default attribute and in the selector we assign our button as you can see below

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">


    <item
        android:state_pressed="true"
        android:drawable="@drawable/button_pressed"/>
    <item
        android:state_enabled="false"
        android:drawable="@drawable/button_disabled"/>
    <item
        android:drawable="@drawable/button_default"/>

                                                                    
</selector>

Main Activity.Xml

Finally we go into our Main Activity.xml and we add a button and set the background to our @drawable/custom_button and after doing this the system will take our three custom buttons as a one custom button and we will get our custom button background.

then we set a switch for disable purpose.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:gravity="center"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="8dp"
        android:background="@drawable/custom_button"
        android:text="Press Me" />
   


    <Switch
        android:id="@+id/btnSwitch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="Enabled"
        />


</LinearLayout>

after assigning the button and switch we go to our main activity.java file for give a behavior for our widgets.

Main Activity.JAVA

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final Button customButton = findViewById(R.id.btn);
        Switch switchButton= findViewById(R.id.btnSwitch);

        customButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               Toast.makeText(MainActivity.this,"clicked", Toast.LENGTH_LONG).show();


            }
        });

        switchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton ButtonView, boolean isChecked) {
                if (isChecked) {
                    customButton.setEnabled(true);
                } else {
                    customButton.setEnabled(false);
                }
            }
        });
    }
}

We have successfully created our shape drawable button. So Let’s Test it out!

So That’s all for today cod3’rs i hope now you got a understanding of shape drawable and you can also use this method in your projects to create a awesome looking custom button.

if you like this tutorial then make sure stay tuned for future upcoming tutorial’s

Dialogue Box Android Studio

hello Cod3r’s Today you will learn about how to add dialog in android studio .

what you will learn in this tutorial

how to add dialog in app projectAlertDialog.Builder builder
how to use java class in appAppCompatDialogFragment
TUTORIAL LEVEL

Rating: 2 out of 5.

MAIN ACTIVITY.XML

so first of all we set a button for the dialog box then we arrange all the widgets into our relative layout then we assign all widgets to there corresponding id’s.

<?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"
    android:background="#7fdbd1"
    >


    <TextView
        android:id="@+id/tv1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="This is The Example of using Dialog"
        android:textSize="40sp"
        android:gravity="center_horizontal"
        />

    <TextView
        android:id="@+id/tv2"
        android:layout_below="@+id/tv1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:textStyle="bold"
        android:textColor="#a8a232"
        android:text="Tap Button below To Display the dialog"
        android:textSize="20dp" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tv2"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_marginTop="81dp"
        android:layout_marginEnd="152dp"
        android:layout_marginRight="152dp"
        android:foregroundGravity="center_horizontal"
        android:src="@drawable/ic_launcher_foreground" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_marginStart="163dp"
        android:layout_marginLeft="163dp"
        android:layout_marginEnd="160dp"
        android:layout_marginRight="160dp"
        android:layout_marginBottom="179dp"
        android:background="#000000"
        android:text="Open!"
        android:textColor="#b634c9"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</RelativeLayout>

main activity.java

Here we declare are button in the main activity then we set onclick listener’s to them after setting onclick method’s we will create are method opration() {

Then we add a java class for our dialog.

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    private Button button;
    //we declare are button


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

  //we initialize are button and set a on click listener
        button=(Button)findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                opration();
            }
        });
    }
// in main activity we create are method opration() for that we add a java class

    public void opration() {
        dialogX dialogX = new dialogX();
        dialogX.show(getSupportFragmentManager(),"dialogX");


    }
}

DIALOG.JAVA

Finally in dialog.java file we override our oncreate method with Dialog onCreateDialog method and then with the help of AlertDialog.Builder we define are dialog box As you can see below at the code.

package com.example.myapplication;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatDialogFragment;

public class dialogX extends AppCompatDialogFragment {

    // we override our on click method with on create dialog
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        //create function here
        AlertDialog.Builder builder= new AlertDialog.Builder(getActivity());
        builder.setTitle("Operation done")
                .setMessage("Positive")
                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {

                    }
                });
        //we return our function
     return builder.create();
    }
}

So That’s it For Today Cod3r’s

i hope you like this tutorial and after this you can use this method to implement this method for you app. its a cool thing right ! so subscribe for more resources and upcoming tutorial’s cause i will keep on posting for you all Cod3r’s

….

How To Pass Strings To Other Activity Android Studio

what you will learn in this lesson

how to pass strings between activities
Top back Button on second Activity As Result
TUTORIAL LEVEL- 

Rating: 1 out of 5.

So in this tutorial we have to use intent.putExtra class to pass strings between activities

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">

    <EditText
        android:id="@+id/et"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:hint="Enter desired Text here" />

    <Button
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/et"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_marginStart="111dp"
        android:layout_marginLeft="111dp"
        android:layout_marginTop="387dp"
        android:layout_marginEnd="116dp"
        android:layout_marginRight="116dp"
        android:gravity="center_horizontal"
        android:text="open second Activity" />
</RelativeLayout>

Second Activity.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=".Main2Activity">


    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="HEelooow"
        android:textSize="40dp"
        android:gravity="center_horizontal"
        />

</RelativeLayout>

Main Activity.JAVA

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
    private EditText et;
    private Button btn;
 public static final String EXTRA_TEXT="com.example.myapplication.EXTRA_TEXT";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

         btn=(Button)findViewById(R.id.btn);
         btn.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 openActivity();
             }
         });
}

       public void openActivity(){
        EditText editText=(EditText)findViewById(R.id.et);
        String text = editText.getText().toString();

        Intent intent= new Intent(this,Main2Activity.class);
        intent.putExtra(EXTRA_TEXT, text);
                startActivity(intent);
    }

}

Second Activity.JAVA

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class Main2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        Intent intent = getIntent();
        String text =intent.getStringExtra(MainActivity.EXTRA_TEXT);

        TextView textView=(TextView)findViewById(R.id.textView);
        textView.setText(text);
    }
}

that’s all for today’s tutorial guys if you like this tips then share this post.

Click Button Change Activity

  • in this post you will learn how use OnClickListner in your .java project in Android studio
  • and open an activity with that button using OnClickListner method

Hello Coder’s welcome to my first post

this project will look something like this

Second Activity

so As you can see above guys i have created a app example of the onclicklistner method So Lets quickly get to the Tutorial.

Tutorial level

Rating: 1 out of 5.

Main Activity.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"
    tools:context=".MainActivity"
    android:background="@android:color/holo_blue_bright">

    <TextView
        android:id="@+id/tv1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:gravity="center_horizontal"
        android:shadowColor="#000A0505"
        android:text="Hello Coder's"
        android:textSize="40sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.431"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.123" />

    <TextView
        android:id="@+id/tv2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="this is activity 1"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="@+id/tv1"
        app:layout_constraintTop_toBottomOf="@+id/tv1"
        app:layout_constraintVertical_bias="0.288" />

    <Button
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#3F51B5"
        android:text="second Activity"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@+id/tv2"
        app:layout_constraintHorizontal_bias="0.498"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/tv2"
        app:layout_constraintVertical_bias="0.565" />
</androidx.constraintlayout.widget.ConstraintLayout>

Second Activity.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="#090505"
    tools:context=".second_activity">

    <TextView
        android:id="@+id/tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="155dp"
        android:layout_marginLeft="155dp"
        android:layout_marginTop="165dp"
        android:layout_marginEnd="115dp"
        android:layout_marginRight="115dp"
        android:layout_marginBottom="419dp"
        android:background="#4CAF50"
        android:text="This is second activity!"
        android:textSize="40dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.581"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.514" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="60dp"
        android:layout_marginBottom="68dp"
        android:background="#4CAF50"
        android:text="Hello Coders"
        android:textSize="35sp"
        app:layout_constraintBottom_toTopOf="@+id/tv"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Main Activity.Java

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
   //define variable here//

    private TextView txt1,txt2;

    private Button button;
   /* we have two variable here as yo can see above
   1.TextView as txt1 and txt2
   2.Button as button*/

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
      /*then we have to associate the corresponding id's
         to xml and java as you can see below*/


        txt1=(TextView)findViewById(R.id.tv1);
        txt2=(TextView)findViewById(R.id.tv2);
        button=(Button)findViewById(R.id.btn);

         //then we will ad a onClickListener to our button//

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                OpenSecond();
            }
        });

    }
    //we will create a method called  open second ();//

    public void OpenSecond(){
        Intent intent=new Intent(this,second_activity.class);
        startActivity(intent);
    }
}
       //this is the End of Main Activity//

second Activity.Java

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class second_activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_activity);
    }
}
   //That's is for Today's Tutorial Subscribe For more coding tips like this//

So That’s All for this tutorial if you like this post make sure to hit the subsrctibe button cause i am gonna start a series of android studio