List of usage examples for android.os Handler sendMessage
public final boolean sendMessage(Message msg)
From source file:co.uk.rehope.androidapp.DrawableManager.java
public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable((Drawable) drawableMap.get(urlString)); }//from www . j av a 2s. com final Handler handler = new Handler() { public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { // TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:org.hedgewars.hedgeroid.netplay.Netplay.java
boolean sendToNet(ToNetMsgType what, int arg1, Object obj) { if (connection != null) { Handler handler = connection.toNetHandler; return handler.sendMessage(handler.obtainMessage(what.ordinal(), arg1, 0, obj)); } else {//from ww w . j ava 2 s. c om return false; } }
From source file:br.com.agendatech.cadastro.DrawableManager.java
public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); }// w w w. j av a2 s . c o m final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:com.scott.crash.DrawableManager.java
public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); }//from www .j a v a2 s . c om final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:com.example.hotelapp.DrawableManager.java
@SuppressLint("HandlerLeak") public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); }/*from www.j a v a 2 s . co m*/ final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:com.ferg.awful.async.DrawableManager.java
public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys. if (urlString == null) { imageView.setImageDrawable(null); return;//from ww w . j ava 2s . c om } if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); } final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:com.mytutor.search.ImageLoader.java
public void fetchDrawableOnThread(final String urlString, Drawable drawable) { if (drawableMap.containsKey(urlString)) { drawable = drawableMap.get(urlString); }/*from w w w. ja v a 2 s. co m*/ final Handler handler = new Handler() { @Override public void handleMessage(Message message) { final Drawable drawable = (Drawable) message.obj; } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable draw = fetchDrawable(urlString); Message message = handler.obtainMessage(1, draw); handler.sendMessage(message); } }; thread.start(); }
From source file:com.github.bcfurtado.copaapp.util.DrawableManager.java
/** * Carrega a imagem a partir de uma url em uma thread separada da thread da interface. * @param urlString indica a url da imagem * @param imageView indica a imagemView a qual imagem vai ser associada ao ser carregada. *///from w w w.ja v a 2s .c o m public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { if (drawableMap.containsKey(urlString)) { imageView.setImageDrawable(drawableMap.get(urlString)); } final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageView.setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:com.example.prox.model.DrawableLoader.java
public void fetchDrawableOnThread(final String urlString, final ImageView imageView) { imageViewReference = new WeakReference<ImageView>(imageView); if (drawableMap.containsKey(urlString)) { imageViewReference.get().setImageDrawable(drawableMap.get(urlString)); }/*from w w w. j av a2 s . com*/ final Handler handler = new Handler() { @Override public void handleMessage(Message message) { imageViewReference.get().setImageDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }
From source file:com.wilson.android.library.DrawableManager.java
public void fetchDrawableOnThreadForListener(final String urlString, final DrawableManagerListener artItem) { if (drawableMap.containsKey(urlString)) { artItem.setFetchedDrawable(drawableMap.get(urlString)); }// w w w. j a va2 s. co m final Handler handler = new Handler() { @Override public void handleMessage(Message message) { artItem.setFetchedDrawable((Drawable) message.obj); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set artItem to a "pending" image Drawable drawable = fetchDrawable(urlString); Message message = handler.obtainMessage(1, drawable); handler.sendMessage(message); } }; thread.start(); }