Please have a look at the code below: When I use handler like this I get a warning(This Handler class should be static or leaks might occur ) Can someone tell me what is the best way to do this?
private void cacheImages() {
try {
// The handler is inside the function because
// normally this function is called once.
final Handler cacheHandler = new Handler() {
public void handleMessage(Message message) {
switch (message.what) {
case ThreadState.STARTED:
cachingDialog.setMax(message.arg1);
break;
case ThreadState.PROGRESSION_UPDATE:
cachingDialog.setProgress(message.arg1);
break;