Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/src/main/java/com/example/myapplication/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class MainActivity extends AppCompatActivity {
private TextView mTextUsername, mTotalTask;
private Spinner mSpinner;
private RecyclerView mRecyclerView;

private Handler handler;

// List<Task> arrayFromRoom;

Expand Down Expand Up @@ -100,8 +102,14 @@ protected void onCreate(Bundle savedInstanceState) {

for (Task task : success.getData()) {

// com.example.myapplication.Task newTask = new com.example.myapplication.Task(task.getTitle(), task.getBody(), task.getState());
apiListArray.add(new com.example.myapplication.Task(task.getTitle(), task.getBody(), task.getState()));
Bundle bundle = new Bundle();
bundle.putString("true", "true");

Message message = new Message();
message.setData(bundle);

handler.sendMessage(message);
}
Log.i(TAG, "success " );
},
Expand All @@ -122,6 +130,12 @@ protected void onCreate(Bundle savedInstanceState) {
failure -> Log.e("Tutorial", "Observation failed.", failure),
() -> Log.i("Tutorial", "Observation complete.")
);

// Handler
handler = new Handler(Looper.getMainLooper(), msg -> {
recyclerMethod(arrayList);
return true;
});
// Add Back Button in ActionBar
ActionBar actionBar = getSupportActionBar();
// showing the back button in action bar
Expand Down Expand Up @@ -198,4 +212,4 @@ public void onTaskItemClicked(int position) {

//set other important properties
}
}
}