SHARE
TWEET

Java code for MainActivity, Second Android App

gagan93 Feb 14th, 2014 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //package com.example.userid; you may choose to write your own package name
  2.  
  3.  
  4. import android.app.Activity;
  5. import android.os.Bundle;
  6. import android.view.Menu;
  7. import android.view.View;
  8.  
  9. public class MainActivity extends Activity {
  10.  
  11.         Button submit;
  12.         EditText userId,password;      
  13.         @Override
  14.         protected void onCreate(Bundle savedInstanceState) {
  15.                 super.onCreate(savedInstanceState);
  16.                 setContentView(R.layout.activity_main);
  17.                
  18.                 submit   = (Button)findViewById(R.id.button1);
  19.                 userId   = (EditText)findViewById(R.id.editText1);
  20.                 password = (EditText)findViewById(R.id.editText2);
  21.                
  22.                 submit.setOnClickListener(new OnClickListener() {
  23.                        
  24.                         @Override
  25.                         public void onClick(View arg0) {
  26.                                 // TODO Auto-generated method stub
  27.                                 Toast.makeText(getBaseContext(), "User id is "+userId.getText().toString()+
  28.                                         "\nPassword is "+password.getText().toString(), Toast.LENGTH_LONG).show();
  29.                         }
  30.                 });
  31.         }
  32.  
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top