public class LoginActivity extends Activity implements OnClickListener {
public SQLiteDatabase db;
public Cursor cursor;
public SimpleCursorAdapter Adapter=null;
public SimpleCursorAdapter AdapterStomach=null;
public SimpleCursorAdapter AdapterColon=null;
public SimpleCursorAdapter AdapterLiver=null;
public SimpleCursorAdapter AdapterBreast=null;
public SimpleCursorAdapter AdapterCervix=null;
public static final String ROOT_DIR = "/data/data/com.example.dbdbd/databases/";
ProductDBHelper mHelper;
public void setDB() {
File folder = new File(ROOT_DIR);
if(folder.exists()) {
}
else {
folder.mkdirs();
//Toast.makeText(this, "폴더생성", Toast.LENGTH_LONG).show();
}
AssetManager assetManager = getResources().getAssets();
File outfile = new File(ROOT_DIR+"MJFitness.db"); //--폰에 위치할 경로
InputStream is = null;
FileOutputStream fo = null;
long filesize = 0;
try {
// --asset 폴더 및 복사할 DB 지정
is = assetManager.open("MJFitness.db", AssetManager.ACCESS_BUFFER);
filesize = is.available(); //--사이즈 검증
// 파일이 없거나 패키지 폴더에 설치된 DB파일이 포함된 DB파일 보다 크기가 같지않을 경우 DB파일을 덮어 쓴다.
if (outfile.length() <= 0) {
byte[] tempdata = new byte[(int) filesize];
is.read(tempdata);
is.close();
outfile.createNewFile();
fo = new FileOutputStream(outfile);
fo.write(tempdata);
fo.close();
}
else
{
//Toast.makeText(this, "db있음", Toast.LENGTH_LONG).show();
}
} catch (IOException e) {
Toast.makeText(this, "db이동실패", Toast.LENGTH_LONG).show();
}
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
Button LoginBtn = (Button)findViewById(R.id.loginbtn);
LoginBtn.setOnClickListener(this);
}
public void onClick(View v) {
if (v.getId() == R.id.loginbtn){
EditText _id = (EditText)findViewById(R.id.id);
EditText _pass = (EditText)findViewById(R.id.pass);
String id = _id.getText().toString();
String password = _pass.getText().toString();
String sql = "select * from member where id ='" + id + "'";
Cursor c = db.rawQuery(sql, null);
}
}
class ProductDBHelper extends SQLiteOpenHelper{
public ProductDBHelper(Context context) {
super(context, "MJFitness.db", null, 1);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
}
}

try{
EditText _id = (EditText)findViewById(R.id.id);
EditText _pass = (EditText)findViewById(R.id.pass);
String id = _id.getText().toString();
String password = _pass.getText().toString();
String sql = "select * from member where id ='" + id + "'";
Cursor c = db.rawQuery(sql, null);
if(c.moveToFirst()){
do{
////Toast.makeText(getApplicationContext(),c.getString(1),Toast.LENGTH_SHORT).show();
if(password.equals(c.getString(1))){
Toast.makeText(getApplicationContext(),"로그인 되었습니다!!",Toast.LENGTH_SHORT).show();
Intent intent2 = new Intent(LoginActivity.this, MenuActivity.class);
startActivity(intent2);
break;
}
}while(c.moveToNext());
Toast.makeText(getApplicationContext(),"비밀번호가 맞지않습니다!!",Toast.LENGTH_SHORT).show();
//
}else{
Toast.makeText(getApplicationContext(),"존재하지 않은 ID입니다",Toast.LENGTH_SHORT).show();
}//if문 close
}catch(Exception ex){
ex.printStackTrace();
}
인터넷 참고해서 로그인버튼 onclick 할때 이런식으로 짜봤는데 넘어가지않고 별 반응이 없네요
고수분들 도와주세요!!