我的登录代码无法正常工作请检查代码 [英] my login code is not working properly please check the code

查看:79
本文介绍了我的登录代码无法正常工作请检查代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

package MOBI.QUIZ;

import android.app.Activity;
import android.content.Intent;

import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class QUIZMOBIActivity extends Activity{
	
	EditText name,att;
	SQLiteDatabase database;
	Button submit;
	String n,an;
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.retrive);
        submit = (Button)findViewById(R.id.button1);
        name = (EditText)findViewById(R.id.editText1);
        
    	
        submit.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				n=name.getText().toString();
	    Intent i=new Intent(QUIZMOBIActivity.this,viewpage.class);		
			i.putExtra("sid", n);
			startActivity(i);
			}
		});
    }
}

推荐答案

正如我从你的代码中看到的那样,

首先,您已经引用了 SQLiteDatabase 但尚未使用(我假设您正在从数据库中检查用户凭据)。

其次,您编写的代码仅用于从一个活动导航到另一个活动。同样,没有任何用户凭据和登录。



因此,请确保您已经编写了正确的查询来检查使用是否已经过身份验证,如果是,那么你可以使用书面代码(在活动之间导航。)



-KR
As I can see from your code,
First, you have made the reference of SQLiteDatabase but haven't used (I assumed that you're checking user credentials from the Database).
Second, the code you have written is simply for navigating from one activity to other. Again, nothing for user credentials and log in.

So make sure that you have written proper query to check whether the use is authenticated or not and if it is, then you can use the written code (navigation between activities.)

-KR


这篇关于我的登录代码无法正常工作请检查代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆