<div><br></div> <div><pre style="font-family:'굴림체';font-size:9pt;"><span style="color:#000080;font-weight:bold;">public class </span>RegisterActiviy <span style="color:#000080;font-weight:bold;">extends </span>AppCompatActivity {<br><br><span style="color:#808000;">@Override<br></span><span style="color:#808000;"> </span><span style="color:#000080;font-weight:bold;">protected void </span>onCreate(Bundle savedInstanceState) {<br><span style="color:#000080;font-weight:bold;">super</span>.onCreate(savedInstanceState);<br> setContentView(R.layout.<span style="color:#660e7a;font-weight:bold;font-style:italic;">activity_register_activiy</span>);<br><span style="color:#000080;font-weight:bold;">final </span>EditText etName = (EditText) findViewById(R.id.<span style="color:#660e7a;font-weight:bold;font-style:italic;">etName</span>);<br><span style="color:#000080;font-weight:bold;">final </span>EditText etPassword = (EditText)findViewById(R.id.<span style="color:#660e7a;font-weight:bold;font-style:italic;">etPassword</span>);<br><span style="color:#000080;font-weight:bold;">final </span>EditText etPhone = (EditText) findViewById(R.id.<span style="color:#660e7a;font-weight:bold;font-style:italic;">etPhone</span>);<br><span style="color:#000080;font-weight:bold;">final </span>EditText etBirth = (EditText)findViewById(R.id.<span style="color:#660e7a;font-weight:bold;font-style:italic;">etBirth</span>);<br><br><span style="color:#000080;font-weight:bold;">final </span>Button bRegister = (Button) findViewById(R.id.<span style="color:#660e7a;font-weight:bold;font-style:italic;">bRegister</span>);<br><br> bRegister.setOnClickListener(<span style="color:#000080;font-weight:bold;">new </span>View.OnClickListener() {<br><span style="color:#808000;">@Override<br></span><span style="color:#808000;"> </span><span style="color:#000080;font-weight:bold;">public void </span>onClick(View v) {<br><span style="color:#000080;font-weight:bold;">final </span>String name = <span style="color:#660e7a;">etName</span>.getText().toString();<br><span style="color:#000080;font-weight:bold;">final </span>String password = <span style="color:#660e7a;">etPassword</span>.getText().toString();<br><span style="color:#000080;font-weight:bold;">final </span>String phone =<span style="color:#660e7a;">etPhone</span>.getText().toString();<br><span style="color:#000080;font-weight:bold;">final </span>String birth = <span style="color:#660e7a;">etBirth</span>.getText().toString();<br><br> Response.Listener<String> responseListener = <span style="color:#000080;font-weight:bold;">new </span>Response.Listener<String>() {<br><span style="color:#808000;">@Override<br></span><span style="color:#808000;"> </span><span style="color:#000080;font-weight:bold;">public void </span>onResponse(String response) {<br><span style="color:#000080;font-weight:bold;">try </span>{<br> JSONObject jsonResponse = <span style="color:#000080;font-weight:bold;">new </span>JSONObject(response);<br><br><br><span style="color:#000080;font-weight:bold;">boolean </span>success = jsonResponse.getBoolean(<span style="color:#008000;font-weight:bold;">"success"</span>);<br><span style="color:#000080;font-weight:bold;">if </span>(success) {<br><br> Toast.<span style="font-style:italic;">makeText</span>(RegisterActiviy.<span style="color:#000080;font-weight:bold;">this</span>, <span style="color:#008000;font-weight:bold;">"정보입력 성공."</span>, Toast.<span style="color:#660e7a;font-weight:bold;font-style:italic;">LENGTH_SHORT</span>).show();<br><span style="color:#808080;font-style:italic;">// Intent intent = new Intent(RegisterActiviy.this, MainActivity.class);<br></span><span style="color:#808080;font-style:italic;"> // RegisterActiviy.this.startActivity(intent);<br></span><span style="color:#808080;font-style:italic;"> </span>finish();<br> }<br><br><span style="color:#808080;font-style:italic;">//<br></span><span style="color:#808080;font-style:italic;"> </span><span style="color:#000080;font-weight:bold;">else </span>{<br> AlertDialog.Builder builder = <span style="color:#000080;font-weight:bold;">new </span>AlertDialog.Builder(getApplicationContext());<br> builder.setMessage(<span style="color:#008000;font-weight:bold;">"Register Failed"</span>)<br> .setNegativeButton(<span style="color:#008000;font-weight:bold;">"Retry"</span>, <span style="color:#000080;font-weight:bold;">null</span>)<br> .create()<br> .show();<br> }<br> } <span style="color:#000080;font-weight:bold;">catch </span>(JSONException e) {<br> e.printStackTrace();<br> }<br> }<br> };<br><br> RegisterRequest registerRequest = <span style="color:#000080;font-weight:bold;">new </span>RegisterRequest(name, birth, phone, password, responseListener);<br> RequestQueue queue = Volley.<span style="font-style:italic;">newRequestQueue</span>(RegisterActiviy.<span style="color:#000080;font-weight:bold;">this</span>);<br> queue.add(registerRequest);<br> }<br> });<br> }<br>}</pre><pre style="font-family:'굴림체';font-size:9pt;"><br></pre><pre style="font-family:'굴림체';font-size:9pt;">이 소스 상에서 <span style="font-size:9pt;color:#000080;font-weight:bold;">if </span><span style="font-size:9pt;">(success) { 일때 앱상에서 입력한 정보들이 php를 이용하여 DB로 등록되는데요</span></pre><pre style="font-family:'굴림체';font-size:9pt;"><br></pre><pre style="font-family:'굴림체';font-size:9pt;">앱에 입력한 부분들이 1개라도 공백일때 확인키를 누르면 등록되지 않게 하는법이 도통 이 상황에서 머리에 안그려지네요..</pre><pre style="font-family:'굴림체';font-size:9pt;">if (name==""){</pre><pre style="font-family:'굴림체';font-size:9pt;">토스트</pre><pre style="font-family:'굴림체';font-size:9pt;">}</pre><pre style="font-family:'굴림체';font-size:9pt;">이런식으로도 생각해봤는데 너무 단순한가요..?</pre><pre style="font-family:'굴림체';font-size:9pt;"><br></pre><pre style="font-family:'굴림체';font-size:9pt;"><br></pre><pre style="font-family:'굴림체';font-size:9pt;"><br></pre><pre style="font-family:'굴림체';font-size:9pt;"><br></pre></div>
<div style="text-align:center;"><img src="http://eusave.dothome.co.kr/gif.php?id=0B4MpkGgWbWt6T2lObjI2d293VW8" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B1-Nk0QyKrjDeVlnM3hCYllaRkk" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;">
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B1-Nk0QyKrjDeVlnM3hCYllaRkk" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;">
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B1-Nk0QyKrjDRWlMa09ieDZsMlE" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;">
<div style="text-align:center;"><img_ src="http://eusave.dothome.co.kr/gif.php?id=0B8fuRvQ1iHqPX0lRN2drTXU5OWc" alt="iu.jpg" style="font-size:9pt;line-height:1.5;border:none;"></div>
<div style="text-align:center;"></div></div></div></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.