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 { ...@@ -223,7 +223,7 @@ public class DBConnector extends SQLiteOpenHelper {
public ArrayList getPerformanceInfo() { public ArrayList getPerformanceInfo() {
ArrayList<ArrayList<String>> performanceInfoList = new ArrayList<ArrayList<String>>(); ArrayList<ArrayList<String>> performanceInfoList = new ArrayList<>();
//Create query to select user from table //Create query to select user from table
...@@ -235,10 +235,17 @@ public class DBConnector extends SQLiteOpenHelper { ...@@ -235,10 +235,17 @@ public class DBConnector extends SQLiteOpenHelper {
//Execute query //Execute query
Cursor cursor = db.rawQuery(query, null); Cursor cursor = db.rawQuery(query, null);
int playNum = cursor.getCount(); String info;
for (int i=0;i<playNum;i++) { ArrayList<String> tempList = new ArrayList<>();
performanceInfoList.add(new ArrayList<String>());
performanceInfoList.get(i).add(cursor.getString(1)); 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 //Close DB
......
...@@ -29,7 +29,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -29,7 +29,7 @@ public class MainActivity extends AppCompatActivity {
TextView usernameTextView = (TextView) findViewById(R.id.usernameTextView); TextView usernameTextView = (TextView) findViewById(R.id.usernameTextView);
usernameTextView.setText(currentUser); usernameTextView.setText(currentUser);
/* performanceList = new ArrayList<>(); performanceList = new ArrayList<>();
RecyclerView recyclerObj = findViewById(R.id.performanceRecycler); RecyclerView recyclerObj = findViewById(R.id.performanceRecycler);
recyclerObj.setLayoutManager(new LinearLayoutManager(this)); recyclerObj.setLayoutManager(new LinearLayoutManager(this));
...@@ -41,10 +41,9 @@ public class MainActivity extends AppCompatActivity { ...@@ -41,10 +41,9 @@ public class MainActivity extends AppCompatActivity {
ArrayList performanceInfoList = connector.getPerformanceInfo(); ArrayList performanceInfoList = connector.getPerformanceInfo();
for (int i = 0;i<performanceInfoList.size();i++) { for (int i = 0;i<performanceInfoList.size();i++) {
performanceList.add(performanceList.size(), performanceList.add(i, new IdleData(performanceInfoList.get(i).toString()));
new IdleData(performanceInfoList.get(i).toString()));
this.adapter.notifyItemInserted(this.adapter.getItemCount()); 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