java - 如何在我的应用程序的登录页面中使用忘记密码

标签 java android

我正在关注本教程 http://www.linuxforu.com/2010/12/android-application-development-playing-with-sqlite-database/对于在我的 Android 应用程序中使用登录页面,在本教程中没有关于忘记密码的解释,我想也在我的应用程序中添加这些功能。 MYLogin.java

public class UserLoggedInPage extends Activity {

    /* (non-Javadoc)
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.loggedin);
    }

    /* (non-Javadoc)
     * @see android.app.Activity#onBackPressed()
     */
    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Intent i = new Intent(UserLoggedInPage.this, DatabaseActivity.class);
        startActivity(i);
        finish();
    }

xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/title"
    android:gravity="center"
    android:textSize="20sp"
    android:textColor="#000000"
    />

    <TableLayout
        android:id="@+id/layout1"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:padding="30dp"
    >
        <TableRow
            android:id="@+id/row1"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
        >
        <TextView
            android:id="@+id/txtUsername"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="@string/txtUname"
            android:padding="10dp"
            android:textColor="#000000"
        ></TextView>

        <EditText
            android:id="@+id/editUsername"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:layout_weight="0.5"
            android:padding="10dp"
            style="@android:style/Widget.EditText"
            android:textColor="#000000"
        >
        </EditText>
    </TableRow>
    <TableRow
        android:id="@+id/row2"
    >
        <TextView
            android:id="@+id/txtPassword"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="@string/txtPassword"
            android:padding="10dp"
            android:textColor="#000000"
        ></TextView>

        <EditText
            android:id="@+id/editPassword"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:layout_weight="0.5"
            android:padding="10dp"
            style="@android:style/Widget.EditText"
            android:password="true"
            android:textColor="#000000"
        ></EditText>
    </TableRow>
    <TableRow
        android:id="@+id/row3"
        android:layout_gravity="center"
    >
        <Button
            android:id="@+id/buttonLogin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/buttonLogin"
            android:layout_gravity="center"
            android:layout_weight="1"
        ></Button>
        <Button
            android:id="@+id/buttonNewUser"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/buttonSignUp"
            android:layout_gravity="center"
            android:layout_weight="1"
        ></Button>
    </TableRow>
    <TableRow
        android:id="@+id/row3"
        android:layout_gravity="center"
    >
        <Button
            android:id="@+id/buttonShowAll"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/buttonShowAll"
            android:layout_gravity="center"
            android:layout_weight="1"
        ></Button>
        </TableRow>
    </TableLayout>
</LinearLayout>

****Can anyone tell,how to use forgot password in my application,or give some links or tutorial to learn how to put forgot password in android,i am new to android****

最佳答案

您可以添加额外的链接/按钮作为“忘记密码”。 单击此按钮后,创建新 Activity ,您在其中提供一个编辑文本,他可以在其中插入用户名并检查按钮以检查该用户名是否存在于您的数据库中。

检查用户提供的用户名,进行比较,显示结果。

关于java - 如何在我的应用程序的登录页面中使用忘记密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15131615/

相关文章:

java - 将类添加到 Android 中的 list 中

android - 使用 firebase 添加额外的用户信息

android - Android 源代码覆盖如何工作?

Android Fragments 变化

java - 使用 Servlet 上传 ServletFileUpload

java - 匹配列表中 4 个或更多单词的正则表达式

android - Andengine,让 Sprite 随机 move

android - 删除Camera2 Android示例的Surface View

java - 将字符串添加到 ArrayList<LinkedList<String>> Java

java - Maven 和 Java 扩展