Page 382 - MDP2022-2
P. 382
Toast.makeText(RegisteActivity.this, "비밀번호가 일치하지 않습니다", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(RegisteActivity.this, "회원가입에 실패했습니다.", Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
}
int BackConfirm = 0;
@Override
public void onBackPressed() {
if(BackConfirm >= 1) {
Toast.makeText(this, "로그인 화면으로 돌아갑니다", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(RegisteActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
finish();
}
BackConfirm++;
}
}
Register Request -
import com.android.volley.AuthFailureError;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
public class RegisterRequest extends StringRequest {
//서버URL 설정(php 파일 연동)
final static private String URL = "http://juhyuk2004.dothome.co.kr/register.php";
private Map<String, String> map;
public RegisterRequest(String userID, String userName, String userEmail, String userPassword, int userAge,
Response.Listener<String> listener) {
super(Method.POST, URL, listener, null);
map = new HashMap<>();
map.put("userID", userID);
map.put("userName", userName);
map.put("userEmail", userEmail);
map.put("userPassword", userPassword);
map.put("userAge", userAge + "");
}
@Override
protected Map<String, String>getParams() throws AuthFailureError {
return map;
}
}
Storage Activity -
{
private View btn_move2;
private String TAG = storageActivity.class.getSimpleName();
private WebView webView = null;
int backConfirm = 0;
@Override
public void onBackPressed() {
if(backConfirm == 0) {
backConfirm++;
Toast.makeText(this, "오는건 마음대로지만 가는건 아니란다", Toast.LENGTH_LONG).show();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);