Example usage for android.os Looper myLooper

List of usage examples for android.os Looper myLooper

Introduction

In this page you can find the example usage for android.os Looper myLooper.

Prototype

public static @Nullable Looper myLooper() 

Source Link

Document

Return the Looper object associated with the current thread.

Usage

From source file:com.appsimobile.appsii.module.home.config.HomeItemConfigurationHelper.java

void ensureQueryHandler() {
    if (Looper.myLooper() != Looper.getMainLooper()) {
        throw new IllegalStateException("Method can only be called on the main thread");
    }//w ww .j  ava  2 s  .  com
    mQueryHandler = new QueryHandlerImpl(mContext.getContentResolver());
}

From source file:org.wso2.emm.agent.services.location.impl.LocationServiceImpl.java

private LocationServiceImpl(Context context) {
    this.context = context;
    locationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE);
    class LooperThread extends Thread {
        public Handler mHandler;

        public void run() {
            if (Looper.myLooper() == null) {
                Looper.prepare();/*w w  w  .java 2s .c o  m*/
            }
            LocationServiceImpl.this.setLocation();
            mHandler = new Handler() {
                public void handleMessage(Message msg) {
                    Log.e(TAG, "No network/GPS Switched off." + msg);
                }
            };
        }
    }
    new LooperThread().run();
}

From source file:cn.com.lowe.android.tools.net.response.HttpResponseHandler.java

/**
 * Creates a new AsyncHttpResponseHandler
 */// w w  w.  java2  s .  c o  m
public HttpResponseHandler() {
    if (Looper.myLooper() != null) {
        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                HttpResponseHandler.this.handleMessage(msg);
            }
        };
    }
}

From source file:com.uwindsor.elgg.project.http.AsyncHttpResponseHandler.java

/**
 * Creates a new AsyncHttpResponseHandler
 *//*from w w w.j  a va 2 s  .  co  m*/
public AsyncHttpResponseHandler() {

    // Set up a handler to post events back to the correct thread if possible
    if (Looper.myLooper() != null) {
        handler = new Handler() {

            @Override
            public void handleMessage(Message msg) {

                AsyncHttpResponseHandler.this.handleMessage(msg);
            }
        };
    }
}

From source file:de.schildbach.wallet.ui.send.RequestWalletBalanceTask.java

public RequestWalletBalanceTask(final Handler backgroundHandler, final ResultCallback resultCallback,
        @Nullable final String userAgent) {
    this.backgroundHandler = backgroundHandler;
    this.callbackHandler = new Handler(Looper.myLooper());
    this.resultCallback = resultCallback;
    this.userAgent = userAgent;
}

From source file:com.pdfread.standardreader.net.AsyncHttpResponseHandler.java

/**
 * Creates a new AsyncHttpResponseHandler
 *//* www  . j  a v  a  2s. c  om*/
public AsyncHttpResponseHandler() {
    if (Looper.myLooper() != null) {
        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                AsyncHttpResponseHandler.this.handleMessage(msg);
            }
        };
    }
}

From source file:cn.caimatou.canting.utils.http.asynchttp.AsyncHttpResponseHandler.java

/**
 * Creates a new AsyncHttpResponseHandler
 *//*from  w  w w  .j a va 2 s. co m*/
public AsyncHttpResponseHandler() {
    // Set up a handler to post events back to the correct thread if possible
    if (Looper.myLooper() != null) {
        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                AsyncHttpResponseHandler.this.handleMessage(msg);
            }
        };
    }
}

From source file:com.elephant.http.AsyncHttpResponseHandler.java

/**
 * Creates a new AsyncHttpResponseHandler
 *//*from  w w w  .  j a v a  2s .  c  om*/
public AsyncHttpResponseHandler() {
    // Set up a handler to post events back to the correct thread if
    // possible
    if (Looper.myLooper() != null) {
        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                AsyncHttpResponseHandler.this.handleMessage(msg);
            }
        };
    }
}

From source file:com.damytech.HttpConn.AsyncHttpResponseHandler.java

/**
 * Creates a new AsyncHttpResponseHandler
 *///from   ww  w  .  j  a v  a2 s. co  m
@SuppressLint("HandlerLeak")
public AsyncHttpResponseHandler() {
    // Set up a handler to post events back to the correct thread if possible
    if (Looper.myLooper() != null) {
        handler = new Handler() {
            public void handleMessage(Message msg) {
                AsyncHttpResponseHandler.this.handleMessage(msg);
            }
        };
    }
}

From source file:de.langerhans.wallet.ui.send.RequestWalletBalanceTask.java

public RequestWalletBalanceTask(@Nonnull final Handler backgroundHandler,
        @Nonnull final ResultCallback resultCallback, @Nullable final String userAgent) {
    this.backgroundHandler = backgroundHandler;
    this.callbackHandler = new Handler(Looper.myLooper());
    this.resultCallback = resultCallback;
    this.userAgent = userAgent;
}