Android studio实现多个按钮跳转多个页面_android studio仿什么什么,实现多个页面的跳转-程序员宅基地

技术标签: android studio  Android  

Android studio实现多个按钮跳转多个页面

Android studio通过多个按钮实现多个页面的跳转

要求下一个页面有音频、图片、单选按钮(RadioGroup)和复选框(CheckBox),还要求有文本输入框(EditText)和Bundle类及应用Intent传递数据。

其共有五个页面,一应俱全,望对其有帮助!

久违的更新,直接来干货,原项目已上传资源库,有问题私信V:mutou88848
在这里插入图片描述

一、实现效果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、布局配置文件

1、Text.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:background="@drawable/abc">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="67dp"
        android:gravity="center"
        android:text="Android实践示例"
        android:textColor="#FFD700"
        android:textSize="32sp" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="77dp"
        android:src="@drawable/bbb" />

    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="个人音乐"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn2"
        android:layout_width="wrap_content"
        android:layout_height="47dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="个人相册"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn3"
        android:layout_width="wrap_content"
        android:layout_height="47dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="个人信息"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/btn4"
        android:layout_width="wrap_content"
        android:layout_height="48dp"
        android:layout_marginLeft="150dp"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="8dp"
        android:text="用户登录"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:layout_width="133dp"
        android:layout_height="40dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="41dp"
        android:layout_marginRight="8dp"
        android:ems="10"
        android:gravity="center"
        android:text="字典查词"
        android:textColor="#FF5722"
        android:textSize="20sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />


    <EditText
        android:id="@+id/edit"
        android:layout_width="220dp"
        android:layout_height="60dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="41dp"
        android:layout_marginRight="8dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="请输入你要查询的词组"
        android:textSize="18sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txt2" />

    <Button
        android:id="@+id/btn5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="查询"
        android:layout_margin="10dp"
        android:background="@drawable/tuh"
        android:textColor="#ffff"
        android:textSize="24sp" />

<!--    <ImageView-->
<!--        android:layout_width="match_parent"-->
<!--        android:layout_height="103dp"-->
<!--        android:src="@drawable/qqqq" />-->
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/qqqq"/>


</LinearLayout>
</ScrollView>

2、text1.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="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="80dp">

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/tt" />
    <TextView
        android:id="@+id/txt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="播放音乐"
        android:textSize="24sp" />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageButton
            android:id="@+id/Start"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/music_play" />
        <ImageButton
            android:id="@+id/Stop"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/music_stop" />
        <Button
            android:id="@+id/btn11"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="返回"
            android:textSize="24sp"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="40dp"
            android:layout_marginLeft="3dp"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"/>
    </LinearLayout>
</LinearLayout>

3、text2.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="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/abc"
    android:id="@+id/img">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="206dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@drawable/aaaa"
        tools:ignore="MissingConstraints" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="277dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@drawable/dddd"
        tools:ignore="MissingConstraints" />
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@drawable/qqqq"
        tools:ignore="MissingConstraints" />
    <Button
        android:id="@+id/btn11"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="返回"
        android:textSize="24sp"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="40dp"
        android:layout_marginLeft="3dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>

</LinearLayout>

4、text3.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:orientation="vertical"
    >
    <!--androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"/-->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="注册登记信息!"
            android:textSize="34sp"
            android:textStyle="bold"
            android:layout_gravity="center"
            android:textColor="#F44336"
            android:gravity="center"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="个人信息:"
            android:textColor="#FF9966"
            android:textSize="24sp"
            android:textStyle="bold" />


        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="1.姓名:"

            android:textColor="#254CC4"
            android:textSize="14sp" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_marginTop="10dp"
            android:textSize="14sp"
            android:drawableLeft="@drawable/yonghu"
            android:hint="Name"
            android:drawablePadding="10dp"
            android:inputType="textPersonName"
            />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_marginTop="10dp"
            android:text="2.学校:"
            android:textColor="#093A9C"
            android:textSize="14sp"
            />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_marginTop="10dp"
            android:textSize="14sp"
            android:hint="School"
            android:drawablePadding="10dp"
            android:drawableLeft="@drawable/school"
            android:inputType="textPersonName"
            />
        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_marginTop="10dp"
            android:text="3.电话:"
            android:textColor="#093A9C"
            android:textSize="14sp"
            />

        <EditText
            android:id="@+id/editText3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_marginTop="10dp"
            android:textSize="14sp"
            android:hint="Tell"
            android:drawableLeft="@drawable/tel"
            android:drawablePadding="10dp"
            android:inputType="phone"
            />
        <RadioGroup
            android:layout_marginTop="10dp"
            android:id="@+id/rg_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >
            <TextView
                android:id="@+id/textView6"
                android:layout_width="wrap_content"
                android:layout_height="32dp"
                android:layout_marginTop="10dp"
                android:text="4.性别:"
                android:textColor="#093A9C"
                android:textSize="14sp"
                />

            <RadioButton
                android:id="@+id/rb_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="男生"
                android:layout_marginTop="10dp"
                android:textSize="14sp"
                android:checked="true"
                />
            <RadioButton
                android:id="@+id/rb_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="女生"
                android:textSize="14sp"
                android:layout_marginTop="10dp"
                />
        </RadioGroup>
        <TextView
            android:id="@+id/textView7"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:layout_marginTop="10dp"
            android:text="5.是否有以下情况:"
            android:textColor="#093A9C"
            android:textSize="14sp"
            />
        <CheckBox
            android:id="@+id/cb1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否是大学生?"
            android:textSize="14sp"
            android:checked="true"
            android:textColor="#9C27B0"
            />

        <CheckBox
            android:id="@+id/cb2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否是帅哥?"
            android:textSize="14sp"
            android:textColor="#9C27B0"
            android:layout_marginTop="10dp"
            android:checked="true"
            />
        <CheckBox
            android:id="@+id/cb3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否在宿舍学习?"
            android:textSize="14sp"
            android:textColor="#9C27B0"
            android:layout_marginTop="10dp"
            />
        <CheckBox
            android:id="@+id/cb4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="是否打游戏?"
            android:textSize="14sp"
            android:textColor="#9C27B0"
            android:layout_marginTop="10dp"
            />

        <!--Button
            android:id="@+id/button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="提交"
            android:textSize="20dp"
            android:textColor="#AF1237"/-->

        <Button
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="返回!"
            android:layout_margin="10dp"
            android:background="@drawable/tuh"
            android:textColor="#ffff"
            android:textSize="24sp"

            />
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/www"/>
    </LinearLayout>

</ScrollView>

5、text4.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:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <ImageView
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:src="@drawable/login_man"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="48dp"/>
    <EditText
        android:id="@+id/login_id"
        android:layout_width="320dp"
        android:layout_height="48dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="48dp"
        android:background="@drawable/login_div_bg"
        android:paddingLeft="8dp"
        android:text="请输入账号" />
    <EditText
        android:id="@+id/login_password"
        android:layout_width="320dp"
        android:layout_height="48dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="16dp"
        android:background="@drawable/login_div_bg"
        android:paddingLeft="8dp"
        android:text="请输入密码" />
    <Button
        android:id="@+id/login_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="登录"
        android:textSize="20dp"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="155dp"/>
</LinearLayout>

6、text5.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">-->

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:text="欢迎来到字典查询"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.508"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.2" />

    <TextView
        android:id="@+id/txt2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:textSize="24sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintVertical_bias="0.3" />

    <Button
        android:id="@+id/btn6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="248dp"
        android:layout_marginLeft="8dp"
        android:text="返回到字典"
        android:textSize="24sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.478"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

三、逻辑控制代码

1、main.java

package com.example.test;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class main extends AppCompatActivity {
    
    Button btn1,btn2,btn3,btn4,btn5;
    EditText edit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);

        setContentView(R.layout.text);

        btn1 = (Button) findViewById(R.id.btn1);
        btn2 = (Button) findViewById(R.id.btn2);
        btn3 = (Button) findViewById(R.id.btn3);
        btn4 = (Button) findViewById(R.id.btn4);
        btn5 = (Button) findViewById(R.id.btn5);
        edit=(EditText)findViewById(R.id.edit);

        btn1.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText1.class);
                startActivity(intent);
            }
        });
        btn2.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText2.class);
                startActivity(intent);
            }
        });
        btn3.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText3.class);
                startActivity(intent);
            }
        });
        btn4.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText4.class);
                startActivity(intent);
            }
        });
        btn5.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View v) {
    
                Intent intent = new Intent(main.this, MainText5.class);
                Bundle bundle = new Bundle();
                bundle.putString("edit", edit.getText().toString());
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

    }


}

2、maintext1.java

package com.example.test;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

public class MainText1 extends Activity {
    
    ImageButton Start,Stop;
    MediaPlayer mp;
    Button btn1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text1);

        Start=(ImageButton)findViewById(R.id.Start);
        Stop=(ImageButton)findViewById(R.id.Stop);

        Start.setOnClickListener(new mStart());
        Stop.setOnClickListener(new mStop());

        try {
    
            mp= MediaPlayer.create(this, R.raw.abc);
            mp.setLooping(true);
        }
        catch(Exception e){
    
            Toast.makeText(this,"play error", Toast.LENGTH_LONG).show();
        }
    }
    class mStart implements View.OnClickListener{
    
        @Override
        public void onClick(View v) {
    
            try {
    
                if(!mp.isPlaying()){
    
                    mp.start();
                    Start.setImageResource(R.drawable.music_pause);
                }
                else {
    
                    mp.pause();
                    Start.setImageResource(R.drawable.music_play);
                }
            }
            catch(Exception e){
    e.printStackTrace();}
        }
    }
    class mStop implements View.OnClickListener{
    
        @Override
        public void onClick(View v) {
    
            mp.reset();
            try {
    
                mp = MediaPlayer.create(MainText1.this, R.raw.abc);
                mp.setLooping(true);
            }
            catch(Exception e){
     e.printStackTrace();}
            Start.setImageResource(R.drawable.music_play);
        }
    }

}

3、maintext2.java

package com.example.test;

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


import androidx.appcompat.app.AppCompatActivity;

import java.util.ResourceBundle;

public class MainText2 extends AppCompatActivity implements View.OnClickListener {
    
    Button btn11;


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

    }

    @Override
    public void onClick(View v) {
    

    }
}

4.maintext3.java

package com.example.test;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainText3 extends AppCompatActivity implements View.OnClickListener {
    
    Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text3);

    }

    @Override
    public void onClick(View v) {
    

    }
}

5、maintext4.java

package com.example.test;
import android.app.Activity;
import android.os.Bundle;
//import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainText4 extends AppCompatActivity implements View.OnClickListener
{
    
    Button btn;
    EditText login_id,login_password;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.text4);
        login_id = (EditText) findViewById(R.id.login_id);
        login_password = (EditText) findViewById(R.id.login_password);
        btn = (Button) findViewById(R.id.login_button);
        btn.setOnClickListener(this);
    }
    @Override
    public void onClick(View v)
    {
    
        String  str = login_id.getText()+" "+login_password.getText();
        Toast.makeText(this,str,Toast.LENGTH_LONG).show();
    }

}

6、maintext5.java

package com.example.test;
import android.content.Intent;
import android.os.Bundle;
//import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainText5 extends AppCompatActivity implements View. OnClickListener{
    
    Button btn6;
    TextView txt2;
    @Override
    public void onCreate(Bundle bunde) {
    
        super.onCreate(bunde);
        setContentView(R.layout.text5);
        txt2=(TextView)findViewById(R.id.txt2);
        btn6 = (Button)findViewById(R.id.btn6);
        Bundle bb = this.getIntent().getExtras();
        String str = bb.getString("edit");
        txt2.setText(str);
        btn6.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
    
        Intent intent2 = new Intent();
        intent2.setClass(this, main.class);
        startActivityForResult(intent2,0);//返回前一页面界面
    }
}

四、配置信息文件AndroidMAnifest.xml

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

    <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/Theme.Test">
        <activity android:name=".main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MainText1"></activity>
        <activity android:name=".MainText2"></activity>
        <activity android:name=".MainText3"></activity>
        <activity android:name=".MainText4"></activity>
        <activity android:name=".MainText5"></activity>
    </application>

</manifest>

在这里插入图片描述

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/wkt1105436760/article/details/116810593

智能推荐

【华为HCIA-5G学习笔记】01H_5G协议标准的最新进展_hcia5g题库-程序员宅基地

文章浏览阅读900次。ITU:定义需求、愿景3GPP:技术标砖5G从3GPP Release 15开始5G包括两部分:新空口(NR) + 新核心网(NGC);【新】eLTE + EPC 。【存量演进】R15 Ph1 NSA标准(eMBB)在17.12冻结5G组网方式URLLC:探索业务需求和可行的部署模式mMTC:与NB-IoT/eMTC共存5G网络安全将保护用户数据,构筑网络韧性5G安全性更高..._hcia5g题库

Android 9.0 网络评分之---NetworkFactory_以太网 acceptrequest-程序员宅基地

文章浏览阅读2.1k次。一、网络评分框架图二、NetworkFactory 与ConnectivityService连接过程拿以太网为例,以太网的网口检测类EthernetTracker 会在自己的构造函数中将以太网类型的networkfactory 注册到ConnectivityService中。EthernetTracker(Context context, Handler handler) { mHandler = handler; // The services we use. IBind_以太网 acceptrequest

Nginx做代理时X-Forwarded-For信息头的处理_nginx proxy_set_header x-forwarded-for $proxy_add_-程序员宅基地

文章浏览阅读2.7w次。先来看一下X-Forwarded-For的定义:X-Forwarded-For:简称XFF头,它代表客户端,也就是HTTP的请求端真实的IP,只有在通过了HTTP 代理或者负载均衡服务器时才会添加该项。它不是RFC中定义的标准请求头信息,在squid缓存代理服务器开发文档中可以找到该项的详细介绍。标准格式如下:X-Forwarded-For: client1, proxy1, prox_nginx proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;

5:React生命周期以及Diff算法_react diff 发生在哪个阶段-程序员宅基地

文章浏览阅读117次。旧生命周期:初始化阶段: 由ReactDOM.render()触发—初次渲染constructor()componentWillMount()render()componentDidMount() =====> 常用一般在这个钩子中做一些初始化的事,例如:开启定时器、发送网络请求、订阅消息更新阶段: 由组件内部this.setSate()或父组件render触发shouldComponentUpdate()componentWillUpdate()render() ===_react diff 发生在哪个阶段

Angular_文档_04_组件样式_自定义元素_动态组件_css class creation-程序员宅基地

文章浏览阅读949次。Component StylesAngular applications are styled with standard CSS. That means you can apply everything you know about CSS stylesheets, selectors, rules, and media queries directly to Angular applicati..._css class creation

java 异常(exception)分几种类型_常见的几种异常类型 Exception-程序员宅基地

文章浏览阅读7.1k次。常见异常类型:Java中的异常分为两大类:1.Checked Exception(非Runtime Exception)2.Unchecked Exception(Runtime Exception)算数异常类:ArithmeticExecption空指针异常类型:NullPointerException类型强制转换类型:ClassCastException数组负下标异常:NegativeArra..._java exception分類

随便推点

鸿蒙系统荣耀新机,鸿蒙系统要来了?网传荣耀新机搭载鸿蒙 OS-程序员宅基地

文章浏览阅读103次。即使面临即将到来的麒麟 9000 芯片绝版问题,华为依然没有忘记荣耀。作为即将发布的全球首款 5nm 工艺芯片,网传的 1500 万备货量是否能够满足华为 Mate 40 系列的出货量我们暂不知晓。在这样的情况下,网曝新机荣耀 Magic 3 上也搭载了这颗即将绝版的麒麟 9000 处理器。不只是芯片方面,网传荣耀 Magic3 最大的亮点在于其搭载的操作系统。根据网传信息来看,这或许是首部搭载鸿..._荣耀新机 鸿蒙

python编程—回文数判断_python回文数判断代码-程序员宅基地

文章浏览阅读3.9w次,点赞18次,收藏27次。例题:判断一个数是否是回文数。设n是一任意自然数。若将n的各位数字反向排列所得自然数n1与n相等,则称n为一回文数。示例 1: 输入: 121 输出: true示例 2: 输入: -121 输出: false 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因&amp;amp;gt;此它不是一个回文数。示..._python回文数判断代码

详解java虚拟机:1-JVM与Java体系结构_会启动一个java虚拟机进程的是-程序员宅基地

文章浏览阅读342次。一、问题:作为java工程师,是否曾被JVM伤害过?运行中的线上系统突然卡死,系统无法访问,甚至直接报OOM错误,什么原因引起的,不清楚想解决线上系统的JVM GC问题,但是却无从下手?新系统上线,对各个JVM参数设置一脸懵逼,直接默认吧,后期就JJ了?每次面试前都要背一次JVM的一些原理概念性的东西,然而面试经常被问在实际项目中如何调优JVM,如何解决JVM GC等问题,芭比Q了二、java程序和JVM关系:一般现在开发系统,都是在各种框架上进行开发(Spring,Spring MVC等_会启动一个java虚拟机进程的是

One SQL to Rule Them All – an Efficient and Syntactically Idiomatic Approach to Management of Stream...-程序员宅基地

文章浏览阅读532次。文章标题One SQL to Rule Them All – an Efficient and Syntactically Idiomatic Approach to Management of Streams and Tables用SQL统一所有:一种有效的、语法惯用的流和表管理方法syntactically 句法上;语法上;句法;句法性地;句法特征idioma..._proposal for extending sharehold loan

【Algorithm】种子填充算法_快速4联通算法-程序员宅基地

文章浏览阅读1.7w次,点赞24次,收藏81次。转载:https://www.cnblogs.com/icmzn/p/5065306.html【平面区域填充算法】是计算机图形学领域的一个很重要的算法,区域填充即给出一个区域的边界 (也可以是没有边界,只是给出指定颜色),要求将边界范围内的所有象素单元都修改成指定的颜色(也可能是图案填充)。区域填充中最常用的是多边形填色,本文讨论种子填充算法(Seed Filling)如果要填充的区域是以图像..._快速4联通算法

fastq 转换为 fasta-程序员宅基地

文章浏览阅读1.4k次。使用 awkawk '{if(NR%4 == 1){print ">" substr($0, 2)}}{if(NR%4 == 2){print}}' XXX.fastq > XXX.fasta转载于:https://www.cnblogs.com/0820LL/p/10832427.html_fastq转换成fasta