Based on JSON data..How to Toast server Status at doInBackground form a Service

前端 未结 2 1025
谎友^
谎友^ 2021-01-17 07:03

I am trying to Show Toast on Server Status

These are my Types of JSONdata from Server

1) {
    \"status\": \"200\",
    \"response\": {
         


        
2条回答
  •  渐次进展
    2021-01-17 07:57

    You can easily achieve this with Handler inside your doInBackground method:

            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(getApplicationContext(), "Your text here", Toast.LENGTH_SHORT).show();
                    //your toast here
                }
            });
    

提交回复
热议问题