Using existing instance of Handler instead of creating a new one
This commit is contained in:
parent
4181141b4e
commit
f11aff72e6
1 changed files with 2 additions and 3 deletions
|
@ -191,7 +191,7 @@ public class NetworkService extends Service {
|
|||
// Property used to keep track of the currently active node
|
||||
private FullNode mSelectedNode;
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(Transaction.class, new Transaction.TransactionDeserializer())
|
||||
|
@ -736,8 +736,7 @@ public class NetworkService extends Service {
|
|||
Log.e(TAG, "Giving up on connections");
|
||||
stopSelf();
|
||||
} else {
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.postDelayed(new Runnable() {
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d(TAG, "Retrying");
|
||||
|
|
Loading…
Reference in a new issue