AJout d'une textview pour mettre le message d'erreur dans lactivity login.
authorMarseille
Tue, 23 Jun 2009 19:06:57 +0200
changeset 284 5b0ad39e0046
parent 283 ecd2cb5f618e
child 285 1b87dbca7ea2
AJout d'une textview pour mettre le message d'erreur dans lactivity login.
res/layout/login.xml
src/com/beem/project/beem/ui/Login.java
--- a/res/layout/login.xml	Tue Jun 23 18:32:23 2009 +0200
+++ b/res/layout/login.xml	Tue Jun 23 19:06:57 2009 +0200
@@ -3,10 +3,10 @@
 	android:orientation="vertical" android:layout_width="fill_parent"
 	android:layout_height="fill_parent">
 	<ImageView android:id="@+id/log_as_logo" android:src="@drawable/logo"
-		android:layout_width="fill_parent" android:layout_height="wrap_content" />
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:layout_marginBottom="25px" android:layout_marginTop="15px" />
 	<TextView android:id="@+id/log_as_msg" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:text="salut"
-		android:gravity="center_vertical" />
+		android:layout_height="wrap_content" android:gravity="center" />
 	<LinearLayout android:orientation="vertical"
 		android:layout_width="fill_parent" android:layout_height="fill_parent"
 		android:gravity="bottom">
@@ -15,4 +15,5 @@
 		<Button android:id="@+id/log_as_login" android:layout_width="fill_parent"
 			android:layout_height="wrap_content" android:text="Login" />
 	</LinearLayout>
+
 </LinearLayout>
\ No newline at end of file
--- a/src/com/beem/project/beem/ui/Login.java	Tue Jun 23 18:32:23 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java	Tue Jun 23 19:06:57 2009 +0200
@@ -15,6 +15,7 @@
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.beem.project.beem.BeemService;
@@ -135,9 +136,10 @@
 	@Override
 	public void connectionFailed(String errorMsg) throws RemoteException {
 	    mIsConnected = false;
-	    if(xmppFacade != null)
+	    if (xmppFacade != null) {
 		Login.this.unbindService(mServConn);
-	    Login.this.stopService(SERVICE_INTENT);
+		Login.this.stopService(SERVICE_INTENT);
+	    }
 	    connectionHandler.post(new ErrorRunnable(errorMsg));
 	    dismissProgressDialog();
 	    showToast(errorMsg);
@@ -148,6 +150,8 @@
 		@Override
 		public void run() {
 		    Toast.makeText(Login.this, errorMsg, Toast.LENGTH_LONG).show();
+		    TextView labelError = (TextView) findViewById(R.id.log_as_msg);
+		    labelError.setText(errorMsg);
 		}
 	    });
 	}