Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int uid = getApplication().getApplicationInfo().uid;
- uid = android.os.Process.myUid();
- mStartRX = TrafficStats.getUidRxBytes(uid);
- mStartTX = TrafficStats.getUidTxBytes(uid);
- mHandler.postDelayed(mRunnable, 1000);
- private final Runnable mRunnable = new Runnable() {
- public void run() {
- int uid = getApplication().getApplicationInfo().uid;
- uid = android.os.Process.myUid();
- long txApp = TrafficStats.getUidTxBytes(uid) - mStartRX;
- long rxApp = TrafficStats.getUidRxBytes(uid) - mStartTX;
- TextView RX = (TextView) findViewById(R.id.t2);
- TextView TX = (TextView) findViewById(R.id.t3);
- //long rxBytes = TrafficStats.getTotalRxBytes() - mStartRX;
- RX.setText(Long.toString(rxApp));
- //long txBytes = TrafficStats.getTotalTxBytes() - mStartTX;
- TX.setText(Long.toString(txApp));
- mHandler.postDelayed(mRunnable, 1000);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement