The val queue
needs a context and I have to use a context and so I have to use the @Composable so I can write the val context
. but the problem is that where I want to use this function, there is not inside a Composable, so I can't use this function.
How can I write a volley request wihtout context or tell me an alternative way to write context here?
@Composable
fun MyMainVolley() {
val context = LocalContext.current
val queue = Volley.newRequestQueue(context)
val url = "https://rezaapp.downloadseriesmovie.ir/maintxt.php"
val stringRequest = StringRequest(
Request.Method.GET, url,
{ response ->
baseUrl = response
},
{ println("That didn't work!") })
queue.add(stringRequest)
}