android:versionCode="1"
android:versionName="1.0" >
- <uses-sdk android:minSdkVersion="14" />
+ <uses-sdk android:minSdkVersion="13" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
- android:name=".Test1Activity" >
+ android:name=".Test1Activity"
+ android:screenOrientation="portrait"
+ android:configChanges="touchscreen|keyboard"
+ android:theme="@android:style/Theme.Black"
+ android:permission="android.permission.ACCESS_FINE_LOCATION"
+ android:launchMode="standard">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
-
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+
+ <activity
+ android:label="@string/app_name"
+ android:name=".NextActivity" >
+ </activity>
+
</application>
</manifest>
\ No newline at end of file
--- /dev/null
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-13
public static final int ic_launcher=0x7f020000;
}
public static final class id {
- public static final int ok=0x7f050000;
+ public static final int cancel_button=0x7f050005;
+ public static final int frameLayout1=0x7f050000;
+ public static final int frameLayout2=0x7f050003;
+ public static final int login_button=0x7f050004;
+ public static final int password=0x7f050002;
+ public static final int username=0x7f050001;
}
public static final class layout {
public static final int main=0x7f030000;
+ public static final int main2=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f040001;
- public static final int button_ok=0x7f040002;
+ public static final int button_cancel=0x7f040006;
+ public static final int button_login=0x7f040004;
+ public static final int button_ok=0x7f040005;
public static final int hello=0x7f040000;
+ public static final int password=0x7f040003;
+ public static final int username=0x7f040002;
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
android:gravity="right"
- android:orientation="vertical" >
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello" />
-
- <Button
- android:id="@+id/ok"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:onClick="onClickOk"
- android:text="@string/button_ok" />
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:weightSum="1">
+
+ <FrameLayout
+ android:id="@+id/frameLayout1"
+ android:layout_width="match_parent" android:layout_height="70dp">
+ </FrameLayout>
+
+ <EditText
+ android:id="@+id/username"
+ android:singleLine="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="@string/username"/>
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Password:"
+ />
+ <EditText
+ android:id="@+id/password"
+ android:password="true"
+ android:singleLine="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/password"/>
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:id="@+id/frameLayout2"
+ android:layout_height="30dp">
+ </FrameLayout>
+ <Button
+ android:id="@+id/login_button"
+ android:onClick="onClickLogin"
+ android:layout_height="wrap_content"
+ android:text="@string/button_login"
+ android:layout_width="match_parent"
+ android:layout_gravity="center"/>
+ <Button
+ android:id="@+id/cancel_button"
+ android:onClick="onClickCancel"
+ android:gravity="right"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_gravity="right"
+ android:text="@string/button_cancel"/>
+
</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="right"
+ android:orientation="vertical" >
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/hello" />
+
+</LinearLayout>
\ No newline at end of file
<string name="hello">Hello World, Test1Activity!</string>
<string name="app_name">Test1</string>
+ <string name="username">Username</string>
+ <string name="password">Password</string>
+ <string name="button_login">Log In</string>
<string name="button_ok">OK</string>
+ <string name="button_cancel">Cancel</string>
+
+
+
</resources>
\ No newline at end of file
--- /dev/null
+package de.android.test1;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class NextActivity extends Activity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main2);
+ }
+}
package de.android.test1;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
import android.app.Activity;
+import android.content.Intent;
import android.os.Bundle;
import android.view.View;
+import android.widget.EditText;
public class Test1Activity extends Activity {
/** Called when the activity is first created. */
}
public void onClickOk(View v) {
+ Intent i = new Intent(Test1Activity.this, NextActivity.class);
+ this.startActivity(i);
+ }
+
+ public void onClickLogin(View v) {
+ HttpClient httpclient = new DefaultHttpClient();
+
+ //RESTful WebService
+ HttpPost httppost = new HttpPost("http://10.208.184.41/userfront.php/api/51,32/0,5/gpsads.xml");
+
+ EditText uname = (EditText)findViewById(R.id.username);
+ String username = uname.getText().toString();
+ EditText pword = (EditText)findViewById(R.id.password);
+ String password = pword.getText().toString();
+
+ List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
+ nameValuePairs.add(new BasicNameValuePair("username", username));
+ nameValuePairs.add(new BasicNameValuePair("password", password));
+ httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
+
+
+
+
+
+ Intent i = new Intent(Test1Activity.this, NextActivity.class);
+ this.startActivity(i);
+ }
+
+ public void onClickCancel(View v) {
+ finish();
}
}
\ No newline at end of file