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

working db performances list link

parent f9ce8443
......@@ -223,7 +223,7 @@ public class DBConnector extends SQLiteOpenHelper {
public ArrayList getPerformanceInfo() {
ArrayList<ArrayList<String>> performanceInfoList = new ArrayList<ArrayList<String>>();
ArrayList<ArrayList<String>> performanceInfoList = new ArrayList<>();
//Create query to select user from table
......@@ -235,10 +235,17 @@ public class DBConnector extends SQLiteOpenHelper {
//Execute query
Cursor cursor = db.rawQuery(query, null);
int playNum = cursor.getCount();
for (int i=0;i<playNum;i++) {
performanceInfoList.add(new ArrayList<String>());
performanceInfoList.get(i).add(cursor.getString(1));
String info;
ArrayList<String> tempList = new ArrayList<>();
cursor.moveToFirst();
for (int i=0;i<cursor.getCount();i++) {
for (int x=1;x< cursor.getColumnCount();x++) {
info = cursor.getString(x);
tempList.add(info);
}
performanceInfoList.add(tempList);
cursor.moveToNext();
}
//Close DB
......
......@@ -29,7 +29,7 @@ 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));
......@@ -41,10 +41,9 @@ public class MainActivity extends AppCompatActivity {
ArrayList performanceInfoList = connector.getPerformanceInfo();
for (int i = 0;i<performanceInfoList.size();i++) {
performanceList.add(performanceList.size(),
new IdleData(performanceInfoList.get(i).toString()));
performanceList.add(i, new IdleData(performanceInfoList.get(i).toString()));
this.adapter.notifyItemInserted(this.adapter.getItemCount());
}*/
}
}
......
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