1
간단한 요청을 내 서버로 보내고 응답을 텍스트 상자에 표시하려고합니다. 내 서버 코드는 간단한 echo ("hello")이다; . 내 앱에는 요청을 보내기위한 버튼과 두 개의 텍스트 상자가 있습니다. 하나는 응답 표시 용이고 다른 하나는 오류 표시 용입니다. 응답 텍스트 상자에 내 앱이 "hello"로 표시 될 것으로 예상합니다.Android studio volley 나쁜 응답
<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("5938ce5f20b9041ea269c702ae8441d9");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://login.venci.ir/?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
내 "MainActivity.java"코드는 다음과 같습니다 :하지만이를받을
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnSend = (Button) findViewById(R.id.btnSend);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Req Sent", Toast.LENGTH_SHORT).show();
sendReq();
}
});
}
public void sendReq(){
String url = "http://login.venci.ir/index.php";
StringRequest request = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
TextView txtR = (TextView) findViewById(R.id.txtR);
txtR.setText(s);
Toast.makeText(MainActivity.this, "Responce", Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
TextView txtE = (TextView) findViewById(R.id.txtE);
txtE.setText(volleyError.toString());
Toast.makeText(MainActivity.this, "Error", Toast.LENGTH_SHORT).show();
}
});
RequestQueue queue = Volley.newRequestQueue(this);
queue.add(request);
queue.start();
}
}
내 코드 또는 내 서버에있어 문제점은 무엇입니까?