Guest User

Untitled

a guest
Sep 14th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. package BlobCity.xyz.com;
  2.  
  3. import java.io.BufferedReader;
  4.  
  5. import java.io.IOException;
  6. import java.io.InputStream;
  7. import java.io.InputStreamReader;
  8. import java.util.Map;
  9.  
  10. import android.app.Activity;
  11. import android.content.Intent;
  12. import android.content.pm.ActivityInfo;
  13. import android.net.Uri;
  14. import android.os.Bundle;
  15. import android.widget.*;
  16. import android.util.Log;
  17. import android.view.Gravity;
  18. import android.view.View;
  19. import android.view.View.OnClickListener;
  20.  
  21. import org.apache.http.HttpResponse;
  22. import org.apache.http.client.ClientProtocolException;
  23. import org.apache.http.client.methods.HttpGet;
  24. import org.apache.http.impl.client.DefaultHttpClient;
  25.  
  26. public class BlobCity extends Activity
  27. {
  28. /** Called when the activity is first created. */
  29. Button signIn,register;
  30. TextView Blob,City,username,password;
  31. EditText eUsername,ePassword;
  32. @Override
  33. public void onCreate(Bundle savedInstanceState)
  34. {
  35. super.onCreate(savedInstanceState);
  36. setContentView(R.layout.main);
  37.  
  38. signIn = (Button) findViewById(R.id.signIn);
  39. register = (Button) findViewById(R.id.register);
  40.  
  41. Blob = (TextView) findViewById(R.id.blob);
  42. City = (TextView) findViewById(R.id.city);
  43. username = (TextView) findViewById(R.id.username);
  44. password = (TextView) findViewById(R.id.password);
  45.  
  46. eUsername = (EditText) findViewById(R.id.eUsername);
  47. ePassword = (EditText) findViewById(R.id.ePassword);
  48.  
  49. signIn.setOnClickListener(new sendUserPass());
  50. register.setOnClickListener(new regPage());
  51.  
  52. }
  53.  
  54. class sendUserPass implements Button.OnClickListener
  55. {
  56. public void onClick(View v)
  57. {
  58. String uname = eUsername.getText().toString();
  59. String pwd = ePassword.getText().toString();
  60. String requestString = ("http://192.168.1.102:8080/BlobCity/RemoteLogin?email="+ uname + "&pwd=" + pwd);
  61. String line;
  62.  
  63. try {
  64. HttpResponse response = new DefaultHttpClient().execute(new HttpGet(requestString));
  65. InputStream is = response.getEntity().getContent();
  66. BufferedReader br = new BufferedReader(new InputStreamReader(is));
  67. StringBuilder rb = new StringBuilder("");
  68.  
  69. while ((line=br.readLine()) != null)
  70. {
  71. rb.append(line) ;
  72. }
  73. if(rb.toString().equals("0"))
  74. {
  75. Toast toast = Toast.makeText(getApplicationContext(), "Please enter a valid Username and/or Password!", Toast.LENGTH_LONG);
  76. toast.show();
  77. toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
  78. eUsername.setText("");
  79. ePassword.setText("");
  80. }
  81. else
  82. {
  83. setContentView(R.layout.map);
  84. eUsername.setText("");
  85. ePassword.setText("");
  86.  
  87. }
  88. }
  89.  
  90. catch (ClientProtocolException e)
  91. {
  92. e.printStackTrace();
  93. }
  94. catch (IOException e)
  95. {
  96. e.printStackTrace();
  97. }
  98. }
  99. }
  100.  
  101. class regPage implements Button.OnClickListener
  102. {
  103. public void onClick(View v)
  104. {
  105. Intent browse = new Intent( Intent.ACTION_VIEW , Uri.parse("http://www.blobcity.com") );
  106. startActivity(browse);
  107. }
  108. }
  109. }
  110.  
  111. <?xml version="1.0" encoding="utf-8"?>
  112. <AbsoluteLayout
  113. android:id="@+id/widget35"
  114. android:layout_width="fill_parent"
  115. android:layout_height="fill_parent"
  116. xmlns:android="http://schemas.android.com/apk/res/android"
  117. android:background="#d2691e">
  118.  
  119. <TextView
  120. android:textSize="40sp"
  121. android:layout_x="75px"
  122. android:layout_y="25px"
  123. android:id="@+id/blob"
  124. android:text="Blob"
  125. android:layout_width="144px"
  126. android:layout_height="50px"
  127. android:textColor="#ffffff"/>
  128.  
  129. <TextView
  130. android:textSize="40sp"
  131. android:layout_x="158px"
  132. android:layout_y="25px"
  133. android:id="@+id/city"
  134. android:text="City"
  135. android:layout_width="144px"
  136. android:layout_height="57px"
  137. android:textColor="#000000"/>
  138.  
  139. <TextView
  140. android:textSize="20sp"
  141. android:layout_x="110px"
  142. android:layout_y="120px"
  143. android:id="@+id/username"
  144. android:text="Username"
  145. android:layout_width="144px"
  146. android:layout_height="40px"
  147. android:textColor="#000000"/>
  148.  
  149. <EditText
  150. android:layout_x="55px"
  151. android:layout_y="150px"
  152. android:id="@+id/eUsername"
  153. android:text=""
  154. android:layout_width="200px"
  155. android:layout_height="40px"
  156. android:textSize="15sp"/>
  157.  
  158. <TextView
  159. android:textSize="20sp"
  160. android:layout_x="110px"
  161. android:layout_y="190px"
  162. android:id="@+id/password"
  163. android:text="Password"
  164. android:layout_width="144px"
  165. android:layout_height="40px"
  166. android:textColor="#000000"/>
  167.  
  168. <EditText
  169. android:layout_x="55px"
  170. android:layout_y="220px"
  171. android:id="@+id/ePassword"
  172. android:text=""
  173. android:layout_width="200px"
  174. android:layout_height="40px"
  175. android:textSize="15sp" />
  176.  
  177. <Button
  178. android:textSize="15sp"
  179. android:layout_x="55px"
  180. android:layout_y="290px"
  181. android:id="@+id/signIn"
  182. android:text="Sign In"
  183. android:layout_width="200px"
  184. android:layout_height="40px"
  185. android:textColor="#000080"/>
  186.  
  187. <Button
  188. android:textSize="15sp"
  189. android:layout_x="55px"
  190. android:layout_y="340px"
  191. android:id="@+id/register"
  192. android:text="Register Now for FREE"
  193. android:layout_width="200px"
  194. android:layout_height="40px"
  195. android:textColor="#000080"/>
  196. </AbsoluteLayout>
  197.  
  198. import java.util.List;
  199. import android.app.Activity;
  200. import android.os.Bundle;
  201. import android.widget.LinearLayout;
  202. import android.widget.Toast;
  203. import android.view.Gravity;
  204. import android.view.ViewGroup;
  205. import android.widget.*;
  206. import com.google.android.maps.MapActivity;
  207. import com.google.android.maps.MapController;
  208. import com.google.android.maps.MapView;
  209.  
  210. public abstract class myMapView extends MapActivity{
  211. /** Called when the activity is first created. */
  212.  
  213. MapView mapView;
  214.  
  215. public void onCreate(Bundle savedInstanceState) {
  216. super.onCreate(savedInstanceState);
  217. setContentView(R.layout.map);
  218. mapView = (MapView) findViewById(R.id.map);
  219. mapView.setBuiltInZoomControls(true);
  220. mapView.getController().setZoom(20);
  221. }
  222. }
  223.  
  224. <LinearLayout
  225. xmlns:android="http://schemas.android.com/apk/res/android"
  226. android:orientation="vertical"
  227. android:layout_width="fill_parent"
  228. android:layout_height="fill_parent">
  229.  
  230. <com.google.android.maps.MapView
  231. android:id="@+id/map"
  232. android:layout_width="fill_parent"
  233. android:layout_height="fill_parent"
  234. android:layout_margin="20dip"
  235. android:clickable="true"
  236. android:apiKey="the_key_that_i_have" />
  237. </LinearLayout>
  238.  
  239. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  240. package="BlobCity.xyz.com"
  241. android:versionCode="1"
  242. android:versionName="1.0">
  243. <uses-permission android:name="android.permission.INTERNET"/>
  244.  
  245. <application android:icon="@drawable/icon" android:label="@string/app_name">
  246. <uses-library android:name="com.google.android.maps" />
  247. <activity android:name=".BlobCity"
  248. android:label="@string/app_name">
  249. <intent-filter>
  250. <action android:name="android.intent.action.MAIN" />
  251. <category android:name="android.intent.category.LAUNCHER" />
  252. </intent-filter>
  253. </activity>
  254. </application>
  255. </manifest>
  256.  
  257. android:apiKey="example_Maps_ApiKey_String"
Add Comment
Please, Sign In to add comment