Z
Z
zzverr2016-05-08 18:46:17
Android
zzverr, 2016-05-08 18:46:17

How to display string from web by url in TextView?

There is a line available by url that the application needs to download it.

public String getTemperature(String urlsite)
    {        
        String matchtemper = "";
        try
        {
            // загрузка страницы         
            URL url = new URL(urlsite);
            URLConnection conn = url.openConnection();          
            InputStreamReader rd = new InputStreamReader(conn.getInputStream());           
            matchtemper = rd.toString();
            return matchtemper;

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return matchtemper;
    };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zhbert, 2016-05-08
@Zhbert

1. Request a string by url.
2. Parse the response.
3. Show it in textview.
4. ...
5. PROFIT!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question