Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.apka2;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.v7.app.ActionBarActivity;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.RadioButton;
- import android.widget.RadioGroup;
- import android.widget.RatingBar;
- import android.widget.TextView;
- public class MainActivity extends ActionBarActivity {
- TextView tytul;
- RatingBar ocena;
- RadioGroup plec;
- EditText imie;
- Button but;
- Context context;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- context= getApplicationContext();
- tytul=(TextView)findViewById(R.id.tytul);
- ocena=(RatingBar)findViewById(R.id.ratingBar);
- plec=(RadioGroup)findViewById(R.id.plec);
- imie=(EditText)findViewById(R.id.editText1);
- but=(Button)findViewById(R.id.button1);
- tytul.setText("elite haxor");
- but.setText("OK!hehehehehhe");
- but.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- //Toast.makeText(context, "pls dun hurt me gurl dun, no moar", Toast.LENGTH_LONG).show();
- Intent intent=new Intent(context, Ekran2Activity.class);
- RadioButton radioButton=(RadioButton)plec.findViewById(plec.getCheckedRadioButtonId());
- String tytulString= tytul.getText().toString();
- intent.putExtra("tytul",tytulString);
- intent.putExtra("plec", radioButton.getText());
- intent.putExtra("ocena", ocena.getRating());
- startActivity(intent);
- }
- });
- }
- @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;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement