Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. int uid = getApplication().getApplicationInfo().uid;
  2. uid = android.os.Process.myUid();
  3. mStartRX = TrafficStats.getUidRxBytes(uid);
  4. mStartTX = TrafficStats.getUidTxBytes(uid);
  5. mHandler.postDelayed(mRunnable, 1000);
  6.  
  7. private final Runnable mRunnable = new Runnable() {
  8. public void run() {
  9. int uid = getApplication().getApplicationInfo().uid;
  10. uid = android.os.Process.myUid();
  11. long txApp = TrafficStats.getUidTxBytes(uid) - mStartRX;
  12. long rxApp = TrafficStats.getUidRxBytes(uid) - mStartTX;
  13. TextView RX = (TextView) findViewById(R.id.t2);
  14. TextView TX = (TextView) findViewById(R.id.t3);
  15. //long rxBytes = TrafficStats.getTotalRxBytes() - mStartRX;
  16. RX.setText(Long.toString(rxApp));
  17. //long txBytes = TrafficStats.getTotalTxBytes() - mStartTX;
  18. TX.setText(Long.toString(txApp));
  19. mHandler.postDelayed(mRunnable, 1000);
  20. }
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement