-1

How can a rectangle be drawn in AsyncTask of service? Is it possible?

From Android canvas draw rectangle, it said

    drawView = new DrawView(this);
    drawView.setBackgroundColor(Color.WHITE);
    setContentView(drawView);

However, setContentView is a method of Activity. How can I do it in service asynctask?

Community
  • 1
  • 1
WeiHung
  • 109
  • 2
  • 10

1 Answers1

0

I cant see why you want to do this in an Async task, firstly you can't modify the UI thread from the doInBackground method. secondly this doesn't look like a big enough task to warrant putting it on the background thread

Mark Gilchrist
  • 1,972
  • 3
  • 24
  • 44