Hi am new to android and java....i done here login screen by giving username and password hardcoded...(but i have to do for real time situation) when we give username and password it has to login to a welcome screen.(whether i have to use webservices or database ) how to do plz guide me....
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#0000ff" > <ImageView android:src="@drawable/icon" android:id="@+id/imageView1" android:paddingLeft="70dip" android:paddingRight="70dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentLeft="true"></ImageView> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margin="3px" android:layout_below="@+id/imageView1" android:id="@+id/ln1"> <TextView android:id="@+id/textView1" android:layout_alignParentLeft="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Username "></TextView> <EditText android:id="@+id/editText1" android:editable="true" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignLeft="@+id/imageView1" android:layout_alignRight="@+id/imageView1"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margin="3px" android:layout_below="@+id/ln1" android:id="@+id/ln2" > <TextView android:id="@+id/textView2" android:layout_alignParentLeft="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Password "></TextView> <EditText android:id="@+id/editText2" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignLeft="@+id/imageView1" android:layout_alignRight="@+id/imageView1" android:password="true"/> </LinearLayout> <Button android:paddingLeft="10dip" android:layout_alignRight="@+id/ln2" android:id="@+id/but" android:layout_width="100dip" android:layout_height="wrap_content" android:layout_below="@+id/ln2" android:text="Login"/> <TextView android:id="@+id/result" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </RelativeLayout> public class SoloCampuss extends Activity { private EditText usernameEditText; private EditText passwordEditText; private TextView lblResult; Button btn; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final EditText usernameEditText = (EditText) findViewById(R.id.editText1); final EditText passwordEditText = (EditText) findViewById(R.id.editText2); Button btn = (Button)findViewById(R.id.but); btn.setOnClickListener( new OnClickListener(){ public void onClick(View viewParam) { lblResult = (TextView)findViewById(R.id.result); String UserName = usernameEditText.getText().toString(); String Password = passwordEditText.getText().toString(); if(UserName.equals("arun") && Password.equals("arun")){ Intent intent=new Intent(SoloCampuss .this,WelcomePage.class); startActivity(intent); } else { lblResult.setText("Login failed. Username and/or password doesn't match."); } } } ); } } thanks in advance arun -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en