I want to get a response from the site, but I get the Error running 'MainActivity2': The activity must be exported or contain an intent-filter How do I fix it?
public class MainActivity2 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); String query = "https://"; HttpURLConnection connection = null; try { connection = (HttpURLConnection) new URI(query).toURL().openConnection(); connection.setRequestMethod("GET"); //connection.getUseCaches(false); connection.setConnectTimeout(300); connection.setReadTimeout(300); connection.connect(); StringBuilder sb = new StringBuilder(); if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) { BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf8")); String line; while ((line = in.readLine()) != null) { sb.append(line); sb.append("\n"); } System.out.println(sb.toString()); } else { System.out.println("ошибка: " + connection.getResponseCode() + ", " + connection.getResponseMessage()); } } catch (Throwable cause) { cause.printStackTrace(); } finally { if (connection != null) ; { connection.disconnect(); } } } }