Skip to content

Instantly share code, notes, and snippets.

@Suchiq
Created August 1, 2022 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Suchiq/03b02cb9ca716fc9b095bffc39b6e0cd to your computer and use it in GitHub Desktop.
Save Suchiq/03b02cb9ca716fc9b095bffc39b6e0cd to your computer and use it in GitHub Desktop.
final TextView textView = findViewById(R.id.textViewStatus);
WorkManager.getInstance().getWorkInfoByIdLiveData(workRequest.getId())
.observe(this, new Observer<WorkInfo>() {
@Override
public void onChanged(@Nullable WorkInfo workInfo) {
//receiving back the data
if(workInfo != null && workInfo.getState().isFinished())
textView.append(workInfo.getOutputData().getString(MyWorker.TASK_DESC) + "\n");
textView.append(workInfo.getState().name() + "\n");
} });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment