Commit ff985e3b authored by christopher.foster's avatar christopher.foster

Login Works, Car Rental List Visible

parent 1e15b5ac
...@@ -9,7 +9,7 @@ import android.database.sqlite.SQLiteOpenHelper; ...@@ -9,7 +9,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class DBConnector extends SQLiteOpenHelper { public class DBConnector extends SQLiteOpenHelper {
private static final int DB_VERSION = 1; private static final int DB_VERSION = 1;
private static final String DB_NAME = "UserDetails"; private static final String DB_NAME = "UserDetails.db";
private static final String TABLE_Users = "Users"; private static final String TABLE_Users = "Users";
private static final String COLUMN_ID = "UserID"; private static final String COLUMN_ID = "UserID";
private static final String COLUMN_Name = "Name"; private static final String COLUMN_Name = "Name";
...@@ -48,7 +48,7 @@ public class DBConnector extends SQLiteOpenHelper { ...@@ -48,7 +48,7 @@ public class DBConnector extends SQLiteOpenHelper {
{ {
boolean correct = false; boolean correct = false;
String query = "Select * FROM " + TABLE_Users + "= \"" + username + "\""; String query = "SELECT * FROM " + TABLE_Users + " WHERE " + COLUMN_UserName + " = \"" + username + "\"";
SQLiteDatabase db = this.getWritableDatabase(); SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null); Cursor cursor = db.rawQuery(query, null);
...@@ -73,7 +73,7 @@ public class DBConnector extends SQLiteOpenHelper { ...@@ -73,7 +73,7 @@ public class DBConnector extends SQLiteOpenHelper {
{ {
//error somewhere in this method //error somewhere in this method
String string = null; String string = null;
String query = "Select * FROM " + TABLE_Users + " WHERE " + COLUMN_UserName + " = \"" + username + "\""; String query = "Select * FROM " + TABLE_Users + " WHERE " + COLUMN_UserName + "= \"" + username + "\"";
SQLiteDatabase db = this.getWritableDatabase(); SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null); Cursor cursor = db.rawQuery(query, null);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="144dp" android:layout_marginStart="144dp"
android:layout_marginLeft="144dp" android:layout_marginLeft="144dp"
android:layout_marginTop="40dp" android:layout_marginTop="32dp"
android:layout_marginEnd="144dp" android:layout_marginEnd="144dp"
android:layout_marginRight="144dp" android:layout_marginRight="144dp"
android:text="Car List" android:text="Car List"
...@@ -21,4 +21,220 @@ ...@@ -21,4 +21,220 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="100dp"
android:text="Benz"
android:textColor="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:text="Toyota"
android:textColor="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:text="Honda"
android:textColor="#000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:text="Jaguar"
android:textColor="#000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView9" />
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:text="Audi"
android:textColor="#000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView10" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="150dp"
android:layout_marginLeft="150dp"
android:layout_marginTop="70dp"
android:text="Specification"
android:textColor="#000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/textView13"
android:layout_width="216dp"
android:layout_height="47dp"
android:layout_marginStart="100dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="90dp"
android:layout_marginRight="90dp"
android:text="Power locks/windows, air bags manual
hatchback, 4 people"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView12" />
<TextView
android:id="@+id/textView14"
android:layout_width="218dp"
android:layout_height="37dp"
android:layout_marginStart="100dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="90dp"
android:layout_marginRight="90dp"
android:text="Manual, air conditioning, diesel,
8 people"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView13" />
<TextView
android:id="@+id/textView15"
android:layout_width="219dp"
android:layout_height="54dp"
android:layout_marginStart="100dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="90dp"
android:layout_marginRight="90dp"
android:text="Power Locks/Windows, air bags,
automatic, air conditioning, 5 people "
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView14" />
<TextView
android:id="@+id/textView16"
android:layout_width="221dp"
android:layout_height="76dp"
android:layout_marginStart="100dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="90dp"
android:layout_marginRight="90dp"
android:text="Cruise control, leather interior, automatic,
air conditioning, tilt steering wheel,
power mirrors, power door locks, 4 people "
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView15" />
<TextView
android:id="@+id/textView17"
android:layout_width="218dp"
android:layout_height="74dp"
android:layout_marginStart="100dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="90dp"
android:layout_marginRight="90dp"
android:text="Power steering, power brakes, power locks
power windows, air bags, automatic
air conditioning, ABS brakes, 2 people "
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView16" />
<TextView
android:id="@+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="Price per \n hour"
android:textColor="#000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:text="£11"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView18" />
<TextView
android:id="@+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:text="£7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView19" />
<TextView
android:id="@+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:text="£9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView20" />
<TextView
android:id="@+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="47dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:text="£10"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView21" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="65dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:text="£8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView22" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment