Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.basel.student_services;
- public class LoginScreen extends AppCompatActivity {`
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login_screen);
- Toolbar tb = (Toolbar)findViewById(R.id.login_tb);
- setSupportActionBar(tb);
- }
- public void login(View view) {
- EditText user = (EditText)findViewById(R.id.user);
- EditText pass = (EditText)findViewById(R.id.pass);
- Intent myIntent = new Intent(this , Main.class);
- Bundle myBundle = new Bundle();
- myBundle.putString("txturs", user.getText().toString());
- myBundle.putString("txtpas", pass.getText().toString());
- myIntent.putExtras(myBundle);
- startActivity(myIntent);
- }
- }
- package com.basel.student_services;
- public class Main extends AppCompatActivity {``
- Toolbar tb;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Bundle bundleOfMain = getIntent().getExtras();
- String usr = bundleOfMain.getString("txturs");
- String pas = bundleOfMain.getString("txtpas");
- TextView tv = (TextView)findViewById(R.id.textView2);
- tv.setText(usr +"n"+ pas);
- tb = (Toolbar)findViewById(R.id.main_toolbar);
- setSupportActionBar(tb);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu){
- MenuInflater m = getMenuInflater();
- m.inflate(R.menu.main_activity_menu, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item ){
- int id = item.getItemId();
- if (id == R.id.men1){
- Toast.makeText(this , "clicked 1" , Toast.LENGTH_LONG).show();
- }
- return super.onOptionsItemSelected(item);
- }
- }
Add Comment
Please, Sign In to add comment