List of usage examples for android.os Handler Handler
@UnsupportedAppUsage public Handler(boolean async)
From source file:com.ruesga.rview.fragments.SnippetFragment.java
public SnippetFragment() { mUiHandler = new Handler(msg -> { if (msg.what == READ_CONTENT_MESSAGE) { readFileContent();/*from w w w .j a va 2 s . c o m*/ } return false; }); }
From source file:de.dsi8.dsi8acl.connection.impl.SocketConnection.java
/** * Default Constructor./*from w w w .j a v a 2s . c om*/ * @param dependencyContainer The {@link Socket} * @param listener Will be informed, when something happen here. */ public SocketConnection(ISocket socket) { this.socket = socket; jsonMapper.configure(Feature.AUTO_CLOSE_TARGET, false); jsonMapper.configure(SerializationFeature.CLOSE_CLOSEABLE, false); jsonMapper.configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, true); messageListenerThread = new MessageListenerThread(this, new Handler(Looper.getMainLooper())); }
From source file:crow.api.ApiClient.java
public ApiClient(Context context, Parser parser, ThreadPoolExecutor threadPool, Cache cache, CookieStore store) {/* w w w.j a v a2 s . c o m*/ this.parser = parser; this.threadPool = threadPool; this.cache = cache; this.handler = new Handler(context.getMainLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what) { case SEND_MESSAGE: RequestRunnable<?, ?> r = (RequestRunnable<?, ?>) msg.obj; r.sendMessageToCallback(); break; } } }; // Create a local instance of cookie store cookieStore = store; // Create local HTTP context localContext = new BasicHttpContext(); // Bind custom cookie store to the local context localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); }
From source file:org.projectbuendia.client.diagnostics.BuendiaApiHealthCheck.java
@Override protected void startImpl() { synchronized (mLock) { if (mHandlerThread == null) { mHandlerThread = new HandlerThread("Buendia API Health Check"); mHandlerThread.start();/*from w w w . j a v a2 s . co m*/ mHandler = new Handler(mHandlerThread.getLooper()); } if (mRunnable == null) { mRunnable = new BuendiaModuleHealthCheckRunnable(mHandler); } if (!mRunnable.isRunning.getAndSet(true)) { mHandler.post(mRunnable); } } }
From source file:com.leanplum.internal.WebSocketClient.java
public WebSocketClient(URI uri, Listener listener, List<BasicNameValuePair> extraHeaders) { mURI = uri;/*from ww w . ja va 2 s. c o m*/ mListener = listener; mExtraHeaders = extraHeaders; mParser = new HybiParser(this); mHandlerThread = new HandlerThread("websocket-thread"); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper()); }
From source file:com.connectsdk.discovery.provider.CastDiscoveryProvider.java
@Override public void start() { stop();//ww w . j av a 2s. com addCallbackTimer = new Timer(); addCallbackTimer.schedule(new TimerTask() { @Override public void run() { sendSearch(); } }, 100, RESCAN_INTERVAL); removeCallbackTimer = new Timer(); removeCallbackTimer.schedule(new TimerTask() { @Override public void run() { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { mMediaRouter.removeCallback(mMediaRouterCallback); } }); } }, 9100, RESCAN_INTERVAL); }
From source file:com.auth0.api.authentication.AuthenticationAPIClient.java
/** * Creates a new API client instance providing Auth0 account info. * * @param auth0 account information/*from ww w. ja v a 2 s. co m*/ */ public AuthenticationAPIClient(Auth0 auth0) { this(auth0, new Handler(Looper.getMainLooper())); }
From source file:it.gulch.linuxday.android.fragments.TrackScheduleListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); day = (Day) getArguments().getSerializable(ARG_DAY); handler = new Handler(this); events = new ArrayList<>(); adapter = new TrackScheduleAdapter(getActivity(), events); setListAdapter(adapter);//from w ww . j av a2 s .c o m if (savedInstanceState != null) { isListAlreadyShown = savedInstanceState.getBoolean("isListAlreadyShown"); } }
From source file:com.kescoode.android.yong.volley.toolbox.BasicNetwork.java
/** * @param httpStack HTTP stack to be used * @param pool a buffer pool that improves GC performance in copy operations *///from ww w . j a v a2 s.c om public BasicNetwork(HttpStack httpStack, ByteArrayPool pool) { this(httpStack, pool, new ExecutorDelivery(new Handler(Looper.getMainLooper()))); }
From source file:com.murrayc.galaxyzoo.app.syncadapter.SyncAdapter.java
public SyncAdapter(final Context context, final boolean autoInitialize) { super(context, autoInitialize); mHandler = new Handler(Looper.getMainLooper()); mClient = new ZooniverseClient(context, Config.SERVER); mSubjectAdder = new SubjectAdder(context, mClient.getRequestQueue()); //We don't listen for the SharedPreferences changes here because it doesn't currently //work across processes, so our listener would never be called. }