Commit f9ce8443 authored by a-j.towse's avatar a-j.towse

fixed dbconnection error

parent 544c033c
......@@ -43,7 +43,6 @@ public class DBConnector extends SQLiteOpenHelper {
private static final String COLUMN_TIXRIVERBANK = "tixRiverBank";
private static final String COLUMN_TIXINCIRC = "tixInCirc";
private static final String COLUMN_TIXOUTCIRC = "tixOutCirc";
private static final String COLUMN_TIXOUTCIRCP = "tixOutCircP";
//Constructor method - create DB
public DBConnector(Context context, SQLiteDatabase.CursorFactory factory) {
......@@ -141,15 +140,13 @@ public class DBConnector extends SQLiteOpenHelper {
play6.put(COLUMN_TIXOUTCIRC, "8,13");
play6.put(COLUMN_TIXSTAND, "10,10");
SQLiteDatabase database = this.getWritableDatabase(); //Create DB access object
db.insert(TABLE_PERFORMANCES, null, play1); //Store play details
db.insert(TABLE_PERFORMANCES, null, play2); //Store play details
db.insert(TABLE_PERFORMANCES, null, play3); //Store play details
db.insert(TABLE_PERFORMANCES, null, play4); //Store play details
db.insert(TABLE_PERFORMANCES, null, play5); //Store play details
db.insert(TABLE_PERFORMANCES, null, play6); //Store play details
db.close();
}
......@@ -252,7 +249,7 @@ public class DBConnector extends SQLiteOpenHelper {
}
//Upgrade DB (to satisfy extends f SQLiteOpenHelper
//Upgrade DB (to satisfy extends f SQLiteOpenHelper)
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
......@@ -260,4 +257,3 @@ public class DBConnector extends SQLiteOpenHelper {
}
......@@ -39,13 +39,12 @@ public class LoginActivity extends AppCompatActivity {
Intent intent = new Intent(this, MainActivity.class);
//create bundle to pass current username
Bundle currentUserBundle = new Bundle();
currentUserBundle.putString("currentUser",username.getText().toString());
currentUserBundle.putString("currentUser", username.getText().toString());
//add bundle to intent
intent.putExtras(currentUserBundle);
//start intent
startActivity(intent);
}
else
} else
Toast.makeText(this, "Username / Password not recognised", Toast.LENGTH_SHORT).show();
}
......
......@@ -29,20 +29,24 @@ public class MainActivity extends AppCompatActivity {
TextView usernameTextView = (TextView) findViewById(R.id.usernameTextView);
usernameTextView.setText(currentUser);
performanceList = new ArrayList<>();
/* performanceList = new ArrayList<>();
RecyclerView recyclerObj = findViewById(R.id.performanceRecycler);
recyclerObj.setLayoutManager(new LinearLayoutManager(this));
adapter = new performanceRecAdapter(this, performanceList);
recyclerObj.setAdapter(adapter);
for ()
performanceList.add(performanceList.size(), new IdleData("Test1 "));
this.adapter.notifyItemInserted(this.adapter.getItemCount());
performanceList.add(performanceList.size(), new IdleData("Test2 "));
this.adapter.notifyItemInserted(this.adapter.getItemCount());
performanceList.add(performanceList.size(), new IdleData("Test3 "));
//Connect to DB
DBConnector connector = new DBConnector(this, null);
ArrayList performanceInfoList = connector.getPerformanceInfo();
for (int i = 0;i<performanceInfoList.size();i++) {
performanceList.add(performanceList.size(),
new IdleData(performanceInfoList.get(i).toString()));
this.adapter.notifyItemInserted(this.adapter.getItemCount());
}*/
}
public void logOutBtn(View view) {
......
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