首页 > 解决方案 > 如何仅使用 gmail 并按“继续”按钮并将电子邮件保存到数据库?

问题描述

我不想用户注册或登录过程,我只想输入用户的 gmail/电子邮件,然后按“继续”按钮。如果用户按下按钮,我只想在我的数据库中保存 gmail 地址。我如何在java代码上做到这一点?

这是我的简单 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"
    tools:context=".MainActivity">


    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Enter your gmail here"
        android:textColor="@color/colorPrimary"
        android:textSize="30dp"
        android:layout_gravity="center"
        android:textAlignment="center"
        android:layout_marginTop="200dp"/>

    <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:inputType="textEmailAddress"
        android:hint="Enter your Gmail here"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"/>

    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="To Contunue"
        android:textAllCaps="false"
        android:layout_marginTop="8dp"
        android:layout_marginLeft="70dp"
        android:layout_marginRight="70dp"/>

    </LinearLayout>

标签: androidandroid-studio-3.3

解决方案


推荐阅读