Guest User

Untitled

a guest
Apr 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. package FirstProgram.program;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.Gravity;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.widget.TextView;
  9. import android.widget.Toast;
  10.  
  11. public class MyFirstProgrammActivity extends Activity {
  12.     /** Called when the activity is first created. */
  13.     @Override
  14.     public void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.main);
  17.        
  18.         final Button btnButton = (Button)findViewById(R.id.btnButton1);
  19.         final TextView tvText = (TextView)findViewById(R.id.tvText1);
  20.        
  21.         btnButton.setOnClickListener(new Button.OnClickListener()
  22.         {
  23.             @Override
  24.             public void onClick(View v)
  25.             {
  26.                 tvText.append("\nПлюс текст");
  27.                 Toast newToast = Toast.makeText(getApplicationContext(), "Добавили еще одну строчку!", 50);
  28.                 newToast.setGravity(Gravity.CENTER, 0, 0);
  29.                 newToast.show();
  30.             }
  31.         });        
  32.     }
  33.    
  34.     @Override
  35.     protected void onStart()
  36.     {
  37.         super.onStart();
  38.        
  39.         Toast StartToast = Toast.makeText(getApplicationContext(), "Старт программы", 1);
  40.         StartToast.show();
  41.         //StartToast.
  42.     }
  43. }
Add Comment
Please, Sign In to add comment