Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.76 KB | None | 0 0
  1. package com.example.form;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.EditText;
  7. import android.widget.RadioButton;
  8. import android.widget.Toast;
  9.  
  10.  
  11. public class MainActivity extends ActionBarActivity {
  12.     EditText imie;
  13.     EditText nazwisko;
  14.     EditText zainteresowania;
  15.     RadioButton man;
  16.     RadioButton woman;
  17.    
  18.     @Override
  19.     protected void onCreate(Bundle savedInstanceState) {
  20.         super.onCreate(savedInstanceState);
  21.         setContentView(R.layout.activity_main);
  22.         imie = (EditText)findViewById(R.id.editText1);
  23.         nazwisko = (EditText)findViewById(R.id.editText2);
  24.         zainteresowania = (EditText)findViewById(R.id.editText3);
  25.         man = (RadioButton)findViewById(R.id.radioButton1);
  26.         woman = (RadioButton)findViewById(R.id.radioButton2);
  27.     }
  28.     public void funkcja(View view){
  29.         if(man.isChecked())Toast.makeText(getApplicationContext(), "Witaj "+
  30.                                                                     imie.getText()+" "+
  31.                                                                     nazwisko.getText()+" "+
  32.                                                                     "jestes mężczyzną a Twoje zainteresowania to: "+
  33.                                                                     zainteresowania.getText(), Toast.LENGTH_LONG).show();
  34.         if(woman.isChecked())Toast.makeText(getApplicationContext(), "Witaj "+
  35.                 imie.getText()+" "+
  36.                 nazwisko.getText()+" "+
  37.                 "jestes kobietą a Twoje zainteresowania to: "+
  38.                 zainteresowania.getText(), Toast.LENGTH_LONG).show();
  39.         Intent sendSms = new Intent(Intent.ACTION_SENDTO, Uri.parse("sms:xxxxxxxxx"));
  40.         sendSms.putExtra("sms_body", "Witaj "+imie.getText()+"");
  41.         startActivity(sendSms);
  42.     }
  43.     public void _man(View view){
  44.         woman.setChecked(false);
  45.     }
  46.     public void _woman(View view){
  47.         man.setChecked(false);
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement