im试图使用VOLLEY将URL中的json数据解析为我的应用这是我的api:http://api.alquran.cloud/v1/surah/1我想显示“ ayahs”数组,但仅显示“ text”对象将它们放在字符串中并使用intent将其发送到另一个活动,并在textView中显示请帮我
这是我的解析方法`public String [] parseJSON(){
final String[] myText=new String[6];
String url = "http://api.alquran.cloud/v1/surah/1";
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject jsonObject=response.getJSONObject("data");
JSONArray jsonArray=jsonObject.getJSONArray("ayahs");
for(int i=0;i==jsonArray.length();i++){
JSONObject aya=jsonArray.getJSONObject(i);
String text=aya.getString("text");
myText[i] =text;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
mRequestQueue.add(request);
return myText;
}
`
这是我的意图发送方法
`public void onItemClick(int position){
//ExampleItem clickedItem = mExampleList.get(position);
// final int sorahNumber=++position;
Intent detailIntent = new Intent(this, DetailActivity.class);
String[] myText = parseJSON();
detailIntent.putExtra("text", myText);
startActivity(detailIntent);
}
`
这是我的目标捕捉者
`公共类DetailActivity扩展了AppCompatActivity {
private TextView sorah_tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
sorah_tv=findViewById(R.id.sorah_tv);
Intent intent=getIntent();
String[] text=intent.getStringArrayExtra("text") ;
for(int i=0;i<text.length;i++){
sorah_tv.setText(text[i]);
}
`
[请帮我
您的帖子尚不清楚您面临的问题是什么,能否请您分享有关此问题的更多详细信息