]> git.ktnx.net Git - mobile-ledger.git/commitdiff
asyncTask: keep reference to the resource manager instead the activity
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 6 Dec 2018 20:37:00 +0000 (20:37 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 6 Dec 2018 20:37:00 +0000 (20:37 +0000)
not that it helps decoupling much

app/src/main/java/net/ktnx/mobileledger/LatestTransactions.java

index 43f58e556c3559498b3ef9deed795cf74ecf63aa..fc55239dfa852212c1f31866e02d8acd03804baf 100644 (file)
@@ -111,7 +111,7 @@ public class LatestTransactions extends AppCompatActivity {
     private void update_accounts() {
         prepare_db();
 
     private void update_accounts() {
         prepare_db();
 
-        Activity activity = this;
+        Resources rm = getResources();
 
         ProgressBar pb = findViewById(R.id.progressBar);
         TextView pt = findViewById(R.id.textProgress);
 
         ProgressBar pb = findViewById(R.id.progressBar);
         TextView pt = findViewById(R.id.textProgress);
@@ -131,7 +131,7 @@ public class LatestTransactions extends AppCompatActivity {
                 pb.setVisibility(GONE);
                 pt.setVisibility(GONE);
                 if (this.error != 0)
                 pb.setVisibility(GONE);
                 pt.setVisibility(GONE);
                 if (this.error != 0)
-                    Snackbar.make(drawer, activity.getResources().getString(this.error), Snackbar.LENGTH_LONG );
+                    Snackbar.make(drawer, rm.getString(this.error), Snackbar.LENGTH_LONG );
             }
         };
 
             }
         };