Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by riza ( 13 years ago )
package com.bytenet.fixil;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final TextView cikti=(TextView)findViewById(R.id.textView1);
        final EditText yazi=(EditText)findViewById(R.id.editText1);
        
        Button buton1=(Button)findViewById(R.id.button1);
        
        buton1.setOnClickListener(new View.OnClickListener() {
         
         public void onClick(View v) {
          
          try {
              // Create a URL for the desired page
              URL url = new URL("www.gnu.org/licenses/gpl.txt");

              // Read all the text returned by the server
              BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
              String str;
              while ((str = in.readLine()) != null) {
               cikti.setText(yazi.getText());
              }
              in.close();
          } catch (MalformedURLException e) {
          } catch (IOException e) {
          }
          
         }
         }); 
        
     }
    


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}

 

Revise this Paste

Your Name: Code Language: