Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package BlobCity.xyz.com;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.util.Map;
- import android.app.Activity;
- import android.content.Intent;
- import android.content.pm.ActivityInfo;
- import android.net.Uri;
- import android.os.Bundle;
- import android.widget.*;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.View;
- import android.view.View.OnClickListener;
- import org.apache.http.HttpResponse;
- import org.apache.http.client.ClientProtocolException;
- import org.apache.http.client.methods.HttpGet;
- import org.apache.http.impl.client.DefaultHttpClient;
- public class BlobCity extends Activity
- {
- /** Called when the activity is first created. */
- Button signIn,register;
- TextView Blob,City,username,password;
- EditText eUsername,ePassword;
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- signIn = (Button) findViewById(R.id.signIn);
- register = (Button) findViewById(R.id.register);
- Blob = (TextView) findViewById(R.id.blob);
- City = (TextView) findViewById(R.id.city);
- username = (TextView) findViewById(R.id.username);
- password = (TextView) findViewById(R.id.password);
- eUsername = (EditText) findViewById(R.id.eUsername);
- ePassword = (EditText) findViewById(R.id.ePassword);
- signIn.setOnClickListener(new sendUserPass());
- register.setOnClickListener(new regPage());
- }
- class sendUserPass implements Button.OnClickListener
- {
- public void onClick(View v)
- {
- String uname = eUsername.getText().toString();
- String pwd = ePassword.getText().toString();
- String requestString = ("http://192.168.1.102:8080/BlobCity/RemoteLogin?email="+ uname + "&pwd=" + pwd);
- String line;
- try {
- HttpResponse response = new DefaultHttpClient().execute(new HttpGet(requestString));
- InputStream is = response.getEntity().getContent();
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- StringBuilder rb = new StringBuilder("");
- while ((line=br.readLine()) != null)
- {
- rb.append(line) ;
- }
- if(rb.toString().equals("0"))
- {
- Toast toast = Toast.makeText(getApplicationContext(), "Please enter a valid Username and/or Password!", Toast.LENGTH_LONG);
- toast.show();
- toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
- eUsername.setText("");
- ePassword.setText("");
- }
- else
- {
- setContentView(R.layout.map);
- eUsername.setText("");
- ePassword.setText("");
- }
- }
- catch (ClientProtocolException e)
- {
- e.printStackTrace();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
- class regPage implements Button.OnClickListener
- {
- public void onClick(View v)
- {
- Intent browse = new Intent( Intent.ACTION_VIEW , Uri.parse("http://www.blobcity.com") );
- startActivity(browse);
- }
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <AbsoluteLayout
- android:id="@+id/widget35"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#d2691e">
- <TextView
- android:textSize="40sp"
- android:layout_x="75px"
- android:layout_y="25px"
- android:id="@+id/blob"
- android:text="Blob"
- android:layout_width="144px"
- android:layout_height="50px"
- android:textColor="#ffffff"/>
- <TextView
- android:textSize="40sp"
- android:layout_x="158px"
- android:layout_y="25px"
- android:id="@+id/city"
- android:text="City"
- android:layout_width="144px"
- android:layout_height="57px"
- android:textColor="#000000"/>
- <TextView
- android:textSize="20sp"
- android:layout_x="110px"
- android:layout_y="120px"
- android:id="@+id/username"
- android:text="Username"
- android:layout_width="144px"
- android:layout_height="40px"
- android:textColor="#000000"/>
- <EditText
- android:layout_x="55px"
- android:layout_y="150px"
- android:id="@+id/eUsername"
- android:text=""
- android:layout_width="200px"
- android:layout_height="40px"
- android:textSize="15sp"/>
- <TextView
- android:textSize="20sp"
- android:layout_x="110px"
- android:layout_y="190px"
- android:id="@+id/password"
- android:text="Password"
- android:layout_width="144px"
- android:layout_height="40px"
- android:textColor="#000000"/>
- <EditText
- android:layout_x="55px"
- android:layout_y="220px"
- android:id="@+id/ePassword"
- android:text=""
- android:layout_width="200px"
- android:layout_height="40px"
- android:textSize="15sp" />
- <Button
- android:textSize="15sp"
- android:layout_x="55px"
- android:layout_y="290px"
- android:id="@+id/signIn"
- android:text="Sign In"
- android:layout_width="200px"
- android:layout_height="40px"
- android:textColor="#000080"/>
- <Button
- android:textSize="15sp"
- android:layout_x="55px"
- android:layout_y="340px"
- android:id="@+id/register"
- android:text="Register Now for FREE"
- android:layout_width="200px"
- android:layout_height="40px"
- android:textColor="#000080"/>
- </AbsoluteLayout>
- import java.util.List;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.LinearLayout;
- import android.widget.Toast;
- import android.view.Gravity;
- import android.view.ViewGroup;
- import android.widget.*;
- import com.google.android.maps.MapActivity;
- import com.google.android.maps.MapController;
- import com.google.android.maps.MapView;
- public abstract class myMapView extends MapActivity{
- /** Called when the activity is first created. */
- MapView mapView;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.map);
- mapView = (MapView) findViewById(R.id.map);
- mapView.setBuiltInZoomControls(true);
- mapView.getController().setZoom(20);
- }
- }
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <com.google.android.maps.MapView
- android:id="@+id/map"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_margin="20dip"
- android:clickable="true"
- android:apiKey="the_key_that_i_have" />
- </LinearLayout>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="BlobCity.xyz.com"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-permission android:name="android.permission.INTERNET"/>
- <application android:icon="@drawable/icon" android:label="@string/app_name">
- <uses-library android:name="com.google.android.maps" />
- <activity android:name=".BlobCity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
- android:apiKey="example_Maps_ApiKey_String"
Add Comment
Please, Sign In to add comment