Permalink
Browse files

added login button. updated layout a bit. binding onClick on login su…

…bmit
  • Loading branch information...
1 parent c093099 commit 6141eda717d952a2b2ee38aaa2b3585aabc03d3d @nitindhar7 committed Oct 9, 2011
Showing with 28 additions and 2 deletions.
  1. +1 −0 gen/com/kampr/R.java
  2. +2 −1 res/layout/main.xml
  3. +25 −1 src/com/kampr/KamprActivity.java
View
@@ -18,6 +18,7 @@
public static final int content=0x7f050000;
public static final int header=0x7f050001;
public static final int login_password=0x7f050005;
+ public static final int login_submit=0x7f050006;
public static final int login_username=0x7f050004;
public static final int logo=0x7f050002;
}
View
@@ -14,6 +14,7 @@
<EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/login_username" android:typeface="normal" android:visibility="visible" android:autoText="true" android:hint="Username" android:layout_marginBottom="15px">
<requestFocus></requestFocus>
</EditText>
- <EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="textPassword" android:id="@+id/login_password" android:hint="Password"></EditText>
+ <EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="textPassword" android:id="@+id/login_password" android:hint="Password" android:layout_marginBottom="15px"></EditText>
+ <Button android:layout_height="wrap_content" android:id="@+id/login_submit" android:text="Login" android:layout_width="fill_parent"></Button>
</LinearLayout>
</LinearLayout>
@@ -3,18 +3,33 @@
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
import android.view.Window;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
-public class KamprActivity extends Activity {
+public class KamprActivity extends Activity implements OnClickListener {
private final String ACTIVITY_TAG = "KamprActivity";
+ private EditText _loginUsername;
+ private EditText _loginPassword;
+ private Button _loginSubmit;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(ACTIVITY_TAG, "onCreate");
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
+
+ _loginUsername = (EditText)findViewById(R.id.login_username);
+ _loginPassword = (EditText)findViewById(R.id.login_password);
+ _loginSubmit = (Button)findViewById(R.id.login_submit);
+
+ _loginSubmit.setOnClickListener(this);
}
@Override
@@ -47,4 +62,13 @@ protected void onDestroy() {
Log.i(ACTIVITY_TAG, "onDestroy");
}
+ public void onClick(View src) {
+ switch(src.getId()) {
+ case R.id.login_submit:
+ String loginUsername = _loginUsername.getText().toString();
+ String loginPassword = _loginPassword.getText().toString();
+ break;
+ }
+ }
+
}

0 comments on commit 6141eda

Please sign in to comment.