class test2 : AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_test2)
connect()
}
fun connect(){
val queue = Volley.newRequestQueue(this)
val url = "https://www.example.com/Register.php"
val params = HashMap<String,String>()
params["abc"] = "parm1"
params["def"] = "parm2"
params["ghi"] = "parm3"
val stringRequest = StringRequest(Request.Method.POST, url,
Response.Listener<String> { response ->
text_test.text = "Response is: $response"
},
Response.ErrorListener { text_test.text = "That didn't work! " })
queue.add(stringRequest)
}
}
我想在StringRequest
中而不是在JsonObjectRequest
中发送参数。
参数应为"param1=data1¶m2=data2¶m3=data3"
格式
和UTF-8编码。
有什么主意我该如何发送这种格式的数据?