Example usage for android.app ActionBar setSelectedNavigationItem

List of usage examples for android.app ActionBar setSelectedNavigationItem

Introduction

In this page you can find the example usage for android.app ActionBar setSelectedNavigationItem.

Prototype

@Deprecated
public abstract void setSelectedNavigationItem(int position);

Source Link

Document

Set the selected navigation item in list or tabbed navigation modes.

Usage

From source file:it.durip_app.MACActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mac);
    data = new MACSource();
    isIperfRunning = isIperfRunning();//from w w  w.  j av  a 2s  .co m
    isOlsrRunning = isOlsrRunning();
    // Get the message from the intent
    Intent intent = getIntent();
    paramUrl = intent.getStringExtra(MainActivity.PARAM_URL);
    paramT = intent.getIntExtra(MainActivity.PARAM_T, 200);
    paramI = intent.getIntExtra(MainActivity.PARAM_I, 5);
    paramMAC = intent.getStringExtra(MainActivity.PARAM_MAC);
    paramSleep = intent.getIntExtra(MainActivity.PARAM_SLEEP, 500);
    paramPort = intent.getIntExtra(MainActivity.PARAM_PORT, 4000);
    paramVerbose = intent.getIntExtra(MainActivity.PARAM_VERBOSE, 1);
    data.setUrl(paramUrl);
    data.setT(paramT);
    data.setI(paramI);
    data.setPort(paramPort);
    data.setSleep(paramSleep);
    data.setVerbose(paramVerbose);
    data.setMAC(paramMAC);
    // kick off the data generating thread:
    //mySource = new Thread(data);
    //mySource.start();
    data.startMAC();

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
    // Show the Up button in the action bar.

}

From source file:com.idevity.card.read.ReadMain.java

/**
 * Method onCreate.//from ww w  . jav a2s.c  o  m
 * 
 * @param savedInstanceState
 *            Bundle
 */
@TargetApi(19)
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_read_main);

    /*
     * We will take over the NFC Interface while in the foreground so there
     * is no additional read attempt.
     * 
     * If on KitKat, we will set a filter and ignore any callbacks.
     */
    /****************** Initialize NFC ******************/
    if (debug) {
        Log.d(TAG, "Getting Adaptor...");
    }
    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(this);
    /*
     * Platform version specific handling: KitKat
     */
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) {
        if (debug) {
            Log.d(TAG, "Setting Adaptor up for KitKat");
        }
        ReaderCallback listener = new ReaderCallback() {
            public void onTagDiscovered(Tag tag) {
                /*
                 * Discard the tags here
                 */
                tag = null;
            }
        };
        int flags = NfcAdapter.FLAG_READER_NFC_A | NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK
                | NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS;
        adapter.enableReaderMode(this, listener, flags, null);
    }

    // Get preferences / settings that have been saved
    // get the show log

    this.sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean showLog = this.sharedPref.getBoolean(g.getShowLog(), false);

    // Create the adapter that will return a fragment for each of the three
    // primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager(), this.sharedPref);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is
    // no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(true);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener
    // for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select
            // the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if
            // we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    /*
     * Use the following to determine content to show in the tabs. First,
     * check to see if there is an active intent Also, check to see if there
     * is an active saved instance state If, active intent - use active
     * intent; if active intent = null, and saved instance state !null, use
     * saved instance state; else return user to "main" instructions
     */
    boolean hasIntent = false;
    boolean hasSavedData = false;

    try {
        if (getIntent().getExtras().getByteArray(g.getCardData()) != null) {
            hasIntent = true;
        }
    } catch (Throwable e) {
        Log.e(TAG, "Error: intent " + e.getMessage());
    }

    try {
        if (g.getCard() != null) {
            hasSavedData = true;
        }
    } catch (Throwable e) {
        Log.e(TAG, "Error: saved instance state " + e.getMessage());
    }

    // if intent, populate the variables with the intent values
    // else if saved instance, populate the same variables with the saved
    // instance state
    // else return user to read800-73 activity to read a new card

    if (hasIntent) {
        logStringBuffer = getIntent().getExtras().getString(g.getReaderLog());
        byte[] _data = getIntent().getExtras().getByteArray(g.getCardData());
        this.carddata = new CardData80073(_data);
        if (debug) {
            Log.d(TAG, "Using new card data");
        }
        g.putCard(carddata.toByteArray());
        g.putLogData(logStringBuffer);

    } else if (hasSavedData) {
        logStringBuffer = g.getLogData();
        byte[] _data = g.getCard();
        this.carddata = new CardData80073(_data);
        Log.e(TAG, "Using saved card data");
    } else {
        Intent returnuser = new Intent(this, Read80073.class);
        startActivity(returnuser);
        Log.e(TAG, "No card data found; returning user to read a new card.");
    }

    /*
     * For each of the sections in the app, add a tab to the action bar.
     */
    Tab tabA = actionBar.newTab();
    tabA.setText(getString(R.string.TabRead_Title));
    tabA.setTabListener(this);
    actionBar.addTab(tabA);

    // this one will become the CAK tab
    Tab tabB = actionBar.newTab();
    tabB.setText(getString(R.string.TabCert_Title));
    tabB.setTabListener(this);
    actionBar.addTab(tabB);

    // this one will become the CHUID tab
    Tab tabC = actionBar.newTab();
    tabC.setText(getString(R.string.TabChuid_Title));
    tabC.setTabListener(this);
    actionBar.addTab(tabC);

    // this one will become the APDU log tab
    // only set up the tab is the preferences for Show Log = True

    if (showLog) {
        Tab tabD = actionBar.newTab();
        tabD.setText(getString(R.string.TabLog_Title));
        tabD.setTabListener(this);
        actionBar.addTab(tabD);
    }
}

From source file:com.geotrackin.gpslogger.GpsMainActivity.java

public void SetUpActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(),
            R.array.gps_main_views, android.R.layout.simple_spinner_dropdown_item);

    actionBar.setListNavigationCallbacks(spinnerAdapter, this);

    //Reload the user's previously selected view f73
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    actionBar.setSelectedNavigationItem(prefs.getInt("dropdownview", 0));

    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("");
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME
            | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(R.layout.actionbar);

    ImageButton helpButton = (ImageButton) actionBar.getCustomView().findViewById(R.id.imgHelp);
    helpButton.setOnClickListener(new View.OnClickListener() {
        @Override// w  w w . j  av  a2  s.  c  om
        public void onClick(View view) {
            Intent faqtivity = new Intent(getApplicationContext(), Faqtivity.class);
            startActivity(faqtivity);
        }
    });

}

From source file:awbb.droid.data.RatingActivity.java

/**
 * {@inheritDoc}/*from   w  ww .  j  a v a2 s  .  co m*/
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    // set theme
    ((AwbbApplication) getApplication()).applyTheme(this);

    // create activity
    super.onCreate(savedInstanceState);

    // data source
    DatabaseDataSource.create(this);
    DatabaseDataSource.open();

    // load view
    setContentView(R.layout.activity_rating);

    viewPager = (ViewPager) findViewById(R.id.ratingPager);

    // get data from intent
    Intent intent = getIntent();
    long id = intent.getLongExtra(EXTRA_RATING_ID, -1);

    // init
    if (id == -1) {
        rating = new Rating();
    } else {
        rating = RatingDao.get(id);
    }

    // adapter
    adapter = new RatingPagerAdapter(this, getSupportFragmentManager());
    viewPager.setAdapter(adapter);

    // action bar
    final ActionBar actionBar = getActionBar();
    // FIXME
    // http://developer.android.com/training/implementing-navigation/lateral.html#horizontal-paging
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    // ActionBar.TabListener tabListener = new ActionBar.TabListener() {
    //
    // @Override
    // public void onTabUnselected(Tab tab, FragmentTransaction ft) {
    // // TODO Auto-generated method stub
    //
    // }
    //
    // @Override
    // public void onTabSelected(Tab tab, FragmentTransaction ft) {
    // viewPager.setCurrentItem(tab.getPosition());
    // }
    //
    // @Override
    // public void onTabReselected(Tab tab, FragmentTransaction ft) {
    // // TODO Auto-generated method stub
    //
    // }
    //
    // };

    // add tabs
    // for (int i = 0; i < Sensor.values().length + 1; i++) {
    // actionBar.addTab(actionBar.newTab().setText("tab" +
    // i).setTabListener(tabListener));
    // }

    // page swipe
    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            Log.d(TAG, "onPageSelected position=" + position);
            actionBar.setSelectedNavigationItem(position);
        };

    });
}

From source file:com.example.jenil.parsedemo.GamePlayActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_game_play);

    Intent intent = getIntent();//from  w ww. j  a v a2 s  .  c om
    Phrase = intent.getStringExtra("MOVIE");
    words = Phrase.split(" ");

    opponent = intent.getStringExtra("OPPONENT");

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.

    final ActionBar actionBar = getActionBar();

    if (actionBar == null) {
        Log.i("ALERT", "NULL");
    } else {
        Log.i("ALERT", "NOT NULL");
    }

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount() - 1; i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
    actionBar.addTab(actionBar.newTab().setText("Submit").setTabListener(this));

}

From source file:org.ounl.lifelonglearninghub.nfcecology.fcube.navigate.SwipeFragmentActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pager);

    // Create the adapter that will return a fragment for each of the three
    // primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Actvate home button
    final ActionBar actionBar = getActionBar();
    actionBar.setHomeButtonEnabled(true);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener
    // for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override//from   ww  w.  ja v a 2 s. c o  m
        public void onPageSelected(int position) {
            // When swiping between different app sections, select
            // the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if
            // we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter.
        // Also specify this Activity object, which implements the
        // TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

}

From source file:com.denel.facepatrol.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mycontext = getApplicationContext();

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.// w  w  w .j  a v a  2s.c  o m
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:com.manoj.macawplayer.SwipeViewActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.drawable.theme_skyblue);/*from   w  w w . jav  a2 s  .c  o  m*/
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.swipe_view);
    int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
    TextView actionBarTextView = (TextView) findViewById(actionBarTitleId);

    if (actionBarTextView != null) {
        Log.i("actionBarTextView :", "not null");
        actionBarTextView.setTextColor(Color.GREEN);
    } else
        Log.i("actionBarTextView :", "null");

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    //to remove the title and icon above the action bar
    getActionBar().setDisplayShowTitleEnabled(false);
    getActionBar().setDisplayShowHomeEnabled(false);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    LinearLayout homeScreen = (LinearLayout) findViewById(R.id.swipeviewl);
    utilities = new Utilities();
    utilities.colorSeter(homeScreen, getApplicationContext());

    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
        /*Tab tab = actionBar.getTabAt(i);
        View v  = tab.setgetCustomView();
        v.setBackgroundResource(R.drawable.theme_skyblue);*/
    }
}

From source file:com.packetsender.android.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mContext = getApplicationContext();/* w w  w . jav  a 2 s  . c om*/
    serviceIntent = new Intent(mContext, PacketListenerService.class);
    activeMenu = R.menu.packetlistmenu;

    trafficLogPackets = new ArrayList<Packet>();

    dataStore = new DataStorage(getSharedPreferences(DataStorage.PREFS_SETTINGS_NAME, 0),
            getSharedPreferences(DataStorage.PREFS_SAVEDPACKETS_NAME, 0),
            getSharedPreferences(DataStorage.PREFS_SERVICELOG_NAME, 0),
            getSharedPreferences(DataStorage.PREFS_MAINTRAFFICLOG_NAME, 0));

    dataStore.clearServicePackets();

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

    startListenerService();

    wifiActive = DataStorage.isWifiActive(mContext);
    ipAddress = "";

    if (wifiActive) {
        ipAddress = DataStorage.getIP(mContext);
        Toast.makeText(mContext, "Your IP is " + ipAddress, Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(mContext, "Send only. Wifi is inactive.", Toast.LENGTH_LONG).show();
    }

    //periodically poll the traffic log

    trafficLogPolling = new Runnable() {
        public void run() {

            String msg = dataStore.getToast();
            if (!msg.isEmpty()) {
                Toast.makeText(mContext, msg, Toast.LENGTH_LONG).show();
            }

            Packet[] trafficPackets = dataStore.fetchAllTrafficLogPackets();
            if (trafficPackets.length != trafficLogPackets.size()) {
                trafficLogPackets.clear();
                trafficLogPackets.addAll(Arrays.asList(trafficPackets));
                updateTrafficPacketsList(trafficFragmentView);
                //trafficFragmentView

            }

            //Log.d("main", DataStorage.FILE_LINE( "trafficLogPolling."));
            mHandler.postDelayed(trafficLogPolling, 1100);
        }
    };

    //periodically monitor Wi-Fi
    updateWifi = new Runnable() {
        public void run() {

            boolean checkWifi = DataStorage.isWifiActive(mContext);
            if (checkWifi != wifiActive) {
                if (checkWifi) {
                    ipAddress = DataStorage.getIP(mContext);
                    Toast.makeText(mContext, "Your IP is " + ipAddress, Toast.LENGTH_LONG).show();
                } else {
                    Toast.makeText(mContext, "Wifi is not active", Toast.LENGTH_LONG).show();
                }

                wifiActive = checkWifi;

            }
            mHandler.postDelayed(updateWifi, 5000);
        }
    };

    mHandler.postDelayed(updateWifi, 5000);
    mHandler.postDelayed(trafficLogPolling, 700);
    //setup saved List periodic check
    updateSavedLists = new Runnable() {
        public void run() {
            if (dataStore.isInvalidateLists()) {

                Log.d("main", DataStorage.FILE_LINE("Found invalid lists."));
                updateSavedPacketsList(packetsFragmentView);
                dataStore.clearInvalidateLists();
            }

            mHandler.postDelayed(updateSavedLists, 2000);
        }
    };

    mHandler.postDelayed(updateSavedLists, 7000);

}