I created a new class to connect to the server (Where Json is located) using AsyncTask, I need to create a button that, when clicked, goes to the link. I tried to withdraw the array, but it did not help.
Here is the code MainActiviy.java
package my.home.page; import android.app.Activity; import android.os.Bundle; import android.widget.ListView; import org.json.JSONException; import my.home.page.classss.ParseTask; public class MainActivity extends Activity { public static String LOG_TAG = "my_log"; String Links, names; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView list = (ListView) findViewById(R.id.list); String str = null; try { str = this.getJSON(); } catch (JSONException e) { e.printStackTrace(); } System.out.println(str); } private String getJSON() throws JSONException { ParseTask pt = new ParseTask(); pt.execute(); return null; } } This is what Json looks like on the server.
[{"id":1,"link":"www.vk.com","name":"VK"}, {"id":1,"link":"www.google.com","name":"google"}, {"id":1,"link":"www.ya.ru","name":"Yandex"}]