Handler is abstract ,cannot be instantiated

后端 未结 6 663
一向
一向 2020-12-07 13:03

I am trying to use a Handler in my app. But when i instantiate it like this:

Handler handler = new Handler();

I get the follow

6条回答
  •  我在风中等你
    2020-12-07 13:22

    It seems you have imported a wrong Handler class

    import java.util.logging.Handler;
    

    Change it to

    import android.os.Handler;
    

提交回复
热议问题