[android-developers] Unfortunately the activity has stopped
i tried a simple login page which gets the gps location if the login
condition is satisfied,while running it shows ünfortunately,the
activity has stopped "with an ok button. i have created the avd with
gps support supporting android 4 with google Inc and even set the gps
manually in ddms perspective.here is my launcher activity.
package com.first;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class FirstActivity extends Activity {
EditText txtUserName;
EditText txtPassword;
Button btnLogin;
Button btnCancel;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Context context=this;
txtUserName=(EditText)this.findViewById(R.id.txtUname);
txtPassword=(EditText)this.findViewById(R.id.txtPwd);
btnLogin=(Button)this.findViewById(R.id.btnLogin);
btnLogin=(Button)this.findViewById(R.id.btnLogin);
btnLogin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if((txtUserName.getText().toString()).equals(txtPassword.getText().toString()))
{
Toast.makeText(FirstActivity.this, "Login
Successful",Toast.LENGTH_LONG).show();
Intent i=new Intent(context,com.first.LbsGeocoding.class);
startActivityForResult(i,0);
FirstActivity.this.finish();} else{
Toast.makeText(FirstActivity.this, "Invalid
Login",Toast.LENGTH_LONG).show();
}
}
});
}}
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home