| 5 | import android.util.Log; |
| 6 | |
| 7 | public class Class1 { |
| 8 | public static boolean IsCollected; |
| 9 | |
| 10 | public Class1() { |
| 11 | IsCollected = false; |
| 12 | } |
| 13 | |
| 14 | public String getMessage() { |
| 15 | return "Hello from Class1 instance"; |
| 16 | } |
| 17 | |
| 18 | @Override |
| 19 | protected void finalize() { |
| 20 | IsCollected = true; |
| 21 | } |
| 22 | |
| 23 | public interface Callback1 { |
| 24 | String getMessage(); |
| 25 | } |
| 26 | |
| 27 | public static class Class2 { |
| 28 | public static boolean printMessageWithDelay(final Callback1 cb, final long delay) { |
| 29 | Handler mainThreadHandler = new Handler(Looper.getMainLooper()); |
| 30 | |
| 31 | Runnable r = new Runnable() { |
| 32 | @Override |
| 33 | public void run() { |
| 34 | String s = cb.getMessage(); |
| 35 | Log.d("TestApp", "printMessgeWithDelay=" + s); |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | boolean success = mainThreadHandler.postDelayed(r, delay); |
| 40 | |
| 41 | return success; |
| 42 | } |
| 43 | } |
| 44 | } |
nothing calls this directly
no outgoing calls
no test coverage detected