Esempio n. 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.list_view_layout);

    mReceiver =
        new BroadcastReceiver() {

          @Override
          public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(mAction)) {
              String type = intent.getStringExtra(NoaaService.TYPE);
              if (type.equals(NoaaService.TYPE_IMAGE)) {
                showWxMap(intent);
                mAdapter.clearPendingPos();
              }
            }
          }
        };

    mAdapter = getMapListAdapter();
    setListAdapter(mAdapter);
  }
Esempio n. 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    app = (GpxUploadApplication) getApplication();
    app.sync();
    setContentView(R.layout.gpx_list);

    fillData();

    registerForContextMenu(getListView());

    receiver = new InsertReceiver();
    IntentFilter filter = new IntentFilter(Constants.BROADCAST_INSERTED);
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    registerReceiver(receiver, filter);
    getListView()
        .setOnItemClickListener(
            new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                adapter.toggleChecked(i);
                Log.d("osm", "toggle checked " + i + " " + l);
              }
            });
  }
Esempio n. 3
0
  /**
   * Function that is called when the activity is created
   *
   * @param savedInstanceState a object from the android system that have informations that may be
   *     useful for the activity
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.vehiclelist);
    mDbHelper = new FuelMonitorDbAdapter(this);
    Button addVehicle = (Button) findViewById(R.id.vehiclelist_addvehicle);

    mDbHelper.open();

    fillData();

    registerForContextMenu(getListView());

    addVehicle.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View v) {
            Intent i = new Intent(getApplicationContext(), AddVehicle.class);
            startActivity(i);
          }
        });

    getListView()
        .setOnItemClickListener(
            new OnItemClickListener() {

              public void onItemClick(AdapterView<?> adapter, View view, int position, long arg) {
                Intent i = new Intent(getApplicationContext(), FuelingList.class);
                long id = arg;
                i.putExtra("vehicleID", id);
                startActivity(i);
              }
            });
  }
Esempio n. 4
0
  @TargetApi(11)
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    playlistName = getIntent().getStringExtra("playlist");
    if (null != playlistName && playlistName.length() > 0) {
      isPlayQueue = false;
    }
    MPDApplication app = (MPDApplication) getApplication();
    setContentView(R.layout.playlist_editlist_activity);
    if (isPlayQueue) {
      this.setTitle(R.string.nowPlaying);
    } else {
      this.setTitle(playlistName);
    }
    update();
    app.oMPDAsyncHelper.addStatusChangeListener(this);

    ListView trackList = getListView();
    trackList.setOnCreateContextMenuListener(this);
    ((TouchInterceptor) trackList).setDropListener(mDropListener);
    ((TouchInterceptor) trackList).setRemoveListener(mRemoveListener);
    trackList.setCacheColorHint(0);

    Button button = (Button) findViewById(R.id.Remove);
    button.setOnClickListener(this);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  }
Esempio n. 5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setTheme(YaximApplication.getConfig(this).getTheme());
    super.onCreate(savedInstanceState);

    mChatFontSize = Integer.valueOf(YaximApplication.getConfig(this).chatFontSize);

    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.mainchat);

    getContentResolver()
        .registerContentObserver(RosterProvider.CONTENT_URI, true, mContactObserver);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    registerForContextMenu(getListView());
    setContactFromUri();
    registerXMPPService();
    setSendButton();
    setUserInput();

    String titleUserid;
    if (mUserScreenName != null) {
      titleUserid = mUserScreenName;
    } else {
      titleUserid = mWithJabberID;
    }

    setCustomTitle(titleUserid);

    setChatWindowAdapter();
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.select_categories);
    setTitle(getResources().getString(R.string.select_categories));

    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    lv = getListView();
    lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    lv.setItemsCanFocus(false);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      id = extras.getInt("id");
      try {
        blog = new Blog(id);
      } catch (Exception e) {
        Toast.makeText(this, getResources().getText(R.string.blog_not_found), Toast.LENGTH_SHORT)
            .show();
        finish();
      }
      checkedCategories = extras.getLongArray("checkedCategories");
      categoriesCSV = extras.getString("categoriesCSV");
    }

    loadCategories();
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   final RoboInjector injector = RoboGuice.getInjector(this);
   eventManager = injector.getInstance(EventManager.class);
   injector.injectMembersWithoutViews(this);
   super.onCreate(savedInstanceState);
   eventManager.fire(new OnCreateEvent(savedInstanceState));
 }
  @Override
  protected void onCreate(Bundle icicle) {

    ((ImApp) getApplication()).setAppTheme(this);

    super.onCreate(icicle);

    ThemeableActivity.setBackgroundImage(this);

    mApp = ImApp.getApplication(this);
    mHandler = new MyHandler(this);
    mSignInHelper = new SignInHelper(this);

    ImPluginHelper.getInstance(this).loadAvailablePlugins();

    mProviderCursor =
        managedQuery(
            Imps.Provider.CONTENT_URI_WITH_ACCOUNT,
            PROVIDER_PROJECTION,
            Imps.Provider.CATEGORY
                + "=?"
                + " AND "
                + Imps.Provider.ACTIVE_ACCOUNT_USERNAME
                + " NOT NULL" /* selection */,
            new String[] {ImApp.IMPS_CATEGORY} /* selection args */,
            Imps.Provider.DEFAULT_SORT_ORDER);
    Intent intent = getIntent();

    if (ImApp.ACTION_QUIT.equals(intent.getAction())) {
      signOutAndKillProcess();
      return;
    }

    mAdapter = new ProviderAdapter(this, mProviderCursor);
    setListAdapter(mAdapter);

    ViewGroup godfatherView = (ViewGroup) this.getWindow().getDecorView();
    FontUtils.setRobotoFont(this, godfatherView);

    registerForContextMenu(getListView());

    View emptyView = getLayoutInflater().inflate(R.layout.empty_account_view, godfatherView, false);
    emptyView.setVisibility(View.GONE);
    ((ViewGroup) getListView().getParent()).addView(emptyView);

    getListView().setEmptyView(emptyView);
    emptyView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {

            if (getListView().getCount() == 0) {
              showNewAccountListDialog();
            }
          }
        });
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   Injector injector = Proton.getInjector(this);
   mObserverManager = injector.getInstance(ObserverManager.class);
   mStateEventObserver = injector.getInstance(StateEventObserver.class);
   injector.inject(this);
   super.onCreate(savedInstanceState);
   mObserverManager.fire(new OnCreateEvent(savedInstanceState));
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_home);
   String[] titles = getActivityTitles();
   setListAdapter(
       new ArrayAdapter<String>(
           this, android.R.layout.simple_list_item_1, android.R.id.text1, titles));
 }
Esempio n. 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = getBaseContext();

    prefsWrapper = new PreferencesWrapper(this);

    List<PrefGroup> prefs_list = new ArrayList<PrefGroup>();

    prefs_list.add(
        new PrefGroup(
            R.string.prefs_account_settings,
            R.string.prefs_account_settings_desc,
            R.drawable.ic_prefs_account,
            getAccountSettingsIntent()));

    /*
     * 8/13/2014 Removed to simplify Settings menu

    prefs_list.add(new PrefGroup(R.string.prefs_fast, R.string.prefs_fast_desc,
    		R.drawable.ic_prefs_fast, new Intent(SipManager.ACTION_UI_PREFS_FAST)));

    prefs_list.add(new PrefGroup(R.string.prefs_network, R.string.prefs_network_desc,
    		R.drawable.ic_prefs_network, getIntentForType(PrefsLogic.TYPE_NETWORK)));
    prefs_list.add(new PrefGroup(R.string.prefs_media, R.string.prefs_media_desc,
    		R.drawable.ic_prefs_media, getIntentForType(PrefsLogic.TYPE_MEDIA)));

     *
     */
    prefs_list.add(
        new PrefGroup(
            R.string.prefs_ui,
            R.string.prefs_ui_desc,
            R.drawable.ic_prefs_ui,
            getIntentForType(PrefsLogic.TYPE_UI)));
    prefs_list.add(
        new PrefGroup(
            R.string.prefs_calls,
            R.string.prefs_calls_desc,
            R.drawable.ic_prefs_calls,
            getIntentForType(PrefsLogic.TYPE_CALLS)));
    /*
     * 8/13/2014 Removed to simplify Settings menu

    prefs_list.add(new PrefGroup(R.string.filters, R.string.filters_desc,
    		R.drawable.ic_prefs_filter, new Intent(this, PrefsFilters.class)));

     *
     */

    adapter = new PrefGroupAdapter(this, prefs_list);
    setListAdapter(adapter);

    getListView().setOnCreateContextMenuListener(this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle extras = getIntent().getExtras();
    String word = extras.getString("word");

    setTitle(word);
    getSupportActionBar().setSubtitle("Поиск перевода");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    WordLoader loader = new WordLoader(this);
    loader.execute(word);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UIHelper.SetTheme(this, R.layout.activity_display_light_novel_list);
    UIHelper.SetActionBarDisplayHomeAsUp(this, true);

    loadingText = (TextView) findViewById(R.id.emptyList);
    loadingBar = (ProgressBar) findViewById(R.id.empttListProgress);

    registerForContextMenu(getListView());

    setTitle("Light Novels: Original");
    isInverted = UIHelper.getColorPreferences(this);
    updateContent(false);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UIHelper.SetTheme(this, R.layout.activity_display_light_novel_list);
    UIHelper.SetActionBarDisplayHomeAsUp(this, true);

    loadingText = (TextView) findViewById(R.id.emptyList);
    loadingBar = (ProgressBar) findViewById(R.id.empttListProgress);

    registerForContextMenu(getListView());
    onlyWatched = false;
    // 如果有分类id才是
    categoryid = getIntent().getIntExtra(Constants.EXTRA_CATEGORY_ID, 0);
    switch (categoryid) {
      case Constants.EXTRA_HISTORY_CATEGORY_ID:
        setTitle(getResources().getString(R.string.str_history));
        api = "/api/leixin/cat/" + categoryid;
        break;
      case Constants.EXTRA_XUANHUAN_CATEGORY_ID:
        setTitle(getResources().getString(R.string.str_xuanhuan));
        api = "/api/leixin/cat/" + categoryid;
        break;
      case Constants.EXTRA_KEHUAN_CATEGORY_ID:
        setTitle(getResources().getString(R.string.str_kehuan));
        api = "/api/leixin/cat/" + categoryid;
        break;
      case Constants.EXTRA_QITA_CATEGORY_ID:
        setTitle(getResources().getString(R.string.str_qita));
        api = "/api/leixin/cat/" + categoryid;
        break;
      case Constants.EXTRA_UPDATE_CATEGORY_ID:
        setTitle(getResources().getString(R.string.light_novels));
        api = "/api/book/update/" + categoryid;
        break;
      case Constants.EXTRA_MOOD_CATEGORY_ID:
        setTitle(getResources().getString(R.string.originals));
        api = "/api/book/mood/" + categoryid;
        break;
    }

    registerForContextMenu(getListView());
    isInverted = UIHelper.getColorPreferences(this);

    // Encapsulated in updateContent
    updateContent(false, onlyWatched, api);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    ThemeUtils.onActivityCreateSetTheme(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.import_zip_main);
    mContext = this;
    /* read settings */
    mSettings = getSharedPreferences(PREFS_NAME, 0);

    int sort = mSettings.getInt(PREFS_SORT, 2);

    mFileMag = new FileManager();
    mFileMag.setSortType(sort);

    if (savedInstanceState != null)
      mHandler =
          new EventHandler(
              FileImportActivity.this, mFileMag, savedInstanceState.getString("location"));
    else mHandler = new EventHandler(FileImportActivity.this, mFileMag);

    mTable = mHandler.new TableRow();

    /*
     * sets the ListAdapter for our ListActivity andgives our EventHandler
     * class the same adapter
     */
    mHandler.setListAdapter(mTable);
    setListAdapter(mTable);

    /* register context menu for our list view */
    registerForContextMenu(getListView());

    mPathLabel = (TextView) findViewById(R.id.path_label);
    mPathLabel.setText("path: /sdcard");
    setTitle(R.string.import_title);

    getSupportActionBar()
        .setDisplayOptions(
            ActionBar.DISPLAY_HOME_AS_UP
                | ActionBar.DISPLAY_SHOW_TITLE
                | ActionBar.DISPLAY_SHOW_HOME);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    showSplash();

    setContentView(R.layout.album_list);
    registerForContextMenu(getListView());

    mAlbums = new ArrayList<Album>();
    mController = new AlbumListController(this, mAlbums);
    mController.addOutboxHandler(new Handler(this));

    mAdapter = new AlbumListAdapter(AlbumListActivity.this, R.layout.album_list_item, mAlbums);
    setListAdapter(mAdapter);

    mController.handle(AlbumListController.MESSAGE_LOAD_ALBUMS);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);

    getSupportActionBar().setTitle("Search");
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setIcon(R.drawable.ic_action_previous_item);

    View commonFooter = findViewById(R.id.footer);
    Button dialerButton = (Button) commonFooter.findViewById(R.id.dialerLinkButton);
    Button emergencyButton = (Button) commonFooter.findViewById(R.id.emergencyLinkButton);
    Button mapButton = (Button) commonFooter.findViewById(R.id.mapLinkButton);
    mapButton.setBackgroundResource(R.drawable.map_icon);
    emergencyButton.setBackgroundResource(R.drawable.emergency_icon);
    dialerButton.setBackgroundResource(R.drawable.dialer_icon);

    BuildingDatabase buildingDatabase = new BuildingDatabase(this);
    DepartmentDatabase departmentDatabase = new DepartmentDatabase(this);
    ServicesDatabase servicesDatabase = new ServicesDatabase(this);

    buildingDb = buildingDatabase.getReadableDatabase();
    departmentDb = departmentDatabase.getReadableDatabase();
    serviceDb = servicesDatabase.getReadableDatabase();
    /*
    searchBox.setOnEditorActionListener(new OnEditorActionListener() {

    	@Override
           public boolean onEditorAction(TextView v, int actionId,
                   KeyEvent event) {
               if (event != null&& (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
                   InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                   in.hideSoftInputFromWindow(searchBox
                           .getApplicationWindowToken(),
                           InputMethodManager.HIDE_NOT_ALWAYS);
                  // Must return true here to consume event
                  return true;
               }
               return false;
           }
       });*/
  }
Esempio n. 18
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    String path = intent.getStringExtra("com.example.android.apis.Path");

    if (path == null) {
      path = "";
    }

    setListAdapter(
        new SimpleAdapter(
            this,
            getData(path),
            android.R.layout.simple_list_item_1,
            new String[] {"title"},
            new int[] {android.R.id.text1}));
    getListView().setTextFilterEnabled(true);
  }
  /** @see android.app.Activity#onCreate(android.os.Bundle) */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    showProgress(true);

    mTodoist = new Todoist();

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    String token = preferences.getString(getString(R.string.pref_todoist_token), null);
    if (token == null) {
      Intent intent = new Intent(this, LoginActivity.class);
      startActivityForResult(intent, 200);
    } else {
      mTodoist.setToken(token);
      loadProjects();
    }
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_badge);
   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 }
Esempio n. 21
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.clinic_activity);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle("Clinic List");

    cd = new ConnectionDetector(getApplicationContext());

    if (!cd.isConnectingToInternet()) {

      alert.showAlertDialog(
          ListClinic.this,
          "Internet Connection Error",
          "Please connect to working Internet connection",
          false);

      return;
    }

    Intent in = getIntent();
    MIO_ID = in.getLongExtra("MIO_ID", 0);

    clinictList = new ArrayList<Map<String, String>>();

    task = (LoadClinic) getLastNonConfigurationInstance();
    if (task == null) {
      task = new LoadClinic(this);
      task.execute();

    } else {
      task.attach(this);
      CreateList(task.getJSON());
    }
    // get listview
    ListView lv = getListView();

    lv.setOnItemClickListener(
        new android.widget.AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) {

            TextView clinic_id = ((TextView) view.findViewById(R.id.clinicid));

            TextView clinic_name = ((TextView) view.findViewById(R.id.clinicname));
            TextView clinic_address = ((TextView) view.findViewById(R.id.clinicaddress));
            TextView clinic_target = ((TextView) view.findViewById(R.id.clinic_target_value));
            TextView clinic_market = ((TextView) view.findViewById(R.id.clinicmarket));

            TextView clinic_contact = ((TextView) view.findViewById(R.id.cliniccntnumlbl));

            String vDetails = "Id \t\t\t\t\t: " + clinic_id.getText().toString() + "\n";
            vDetails += "Name \t\t\t: " + clinic_name.getText().toString() + "\n";
            vDetails += "Address \t:  " + clinic_address.getText().toString() + "\n";
            vDetails += "Target \t\t:  " + clinic_target.getText().toString() + "\n";
            vDetails += "Market \t\t: " + clinic_market.getText().toString() + "\n";

            vDetails += "Contact \t:  " + clinic_contact.getText().toString() + "\n";

            alert.showAlertDialog(ListClinic.this, "Clinic Profile", vDetails, true);
          }
        });
  }
Esempio n. 22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(
        Window.FEATURE_INDETERMINATE_PROGRESS); // for progress it will be passed before layout

    // navigation
    if (savedInstanceState != null) {
      mActiveViewId = savedInstanceState.getInt(STATE_ACTIVE_VIEW_ID);
    }

    mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_WINDOW);
    mMenuDrawer.setMenuView(R.layout.menu_scrollview); // this is the layout for

    ////////////////////////////////////////////////////
    // Action bar
    ActionBar mActionBar;
    LayoutInflater mInflater;
    View mCustomView;
    TextView mTitleTextView;
    mActionBar = getSupportActionBar();
    mActionBar.setDisplayShowHomeEnabled(false);
    mActionBar.setDisplayShowTitleEnabled(false);
    mInflater = LayoutInflater.from(this);
    mCustomView = mInflater.inflate(R.layout.menu, null);
    mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
    mTitleTextView.setText("Live");
    mTitleTextView.setTextSize(20);

    mActionBar.setCustomView(mCustomView);
    mActionBar.setDisplayShowCustomEnabled(true);
    // mActionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.at_header_bg));
    ImageButton ibItem1 = (ImageButton) findViewById(R.id.btn_slide);
    ibItem1.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            mMenuDrawer.toggleMenu();
          }
        });

    /////////////////////////////////////////////

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      //           getActionBar().setDisplayHomeAsUpEnabled(true);
      // this is for the color of title bar
      ColorDrawable colorDrawable = new ColorDrawable();
      int myColor = this.getResources().getColor(R.color.menu4);
      colorDrawable.setColor(myColor);
      android.app.ActionBar actionBar = getActionBar();
      actionBar.setBackgroundDrawable(colorDrawable);
    }

    // mContentTextView = (TextView) findViewById(R.id.contentText);
    findViewById(R.id.item1).setOnClickListener(this);
    findViewById(R.id.item2).setOnClickListener(this);
    findViewById(R.id.item3).setOnClickListener(this);
    findViewById(R.id.item4).setOnClickListener(this);
    findViewById(R.id.item5).setOnClickListener(this);
    findViewById(R.id.item6).setOnClickListener(this);
    findViewById(R.id.item7).setOnClickListener(this);
    findViewById(R.id.item8).setOnClickListener(this);

    TextView activeView = (TextView) findViewById(mActiveViewId);
    if (activeView != null) {
      mMenuDrawer.setActiveView(activeView);
      // mContentTextView.setText("Active item: " + activeView.getText());
    }

    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    mMenuDrawer.setMenuSize(width / 4); // size of menu
    mMenuDrawer.setDropShadow(android.R.color.transparent); // removin showdo
    // navigation

    if (isNetworkOnline() == true) { // starting settings if internet is not working
      internt_count = true;
      iamcallin(); // calling the function to build everything

    } else if (isNetworkOnline() == false) {
      setContentView(R.layout.nointernet); // giving new layout to drawer
      // setContentView(R.layout.nointernet);
      internt_count = false;
      Button button = (Button) findViewById(R.id.nointernet_refresh);

      button.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View arg0) {

              Intent myIntent = new Intent(live_first.this, live_first.class); // refreshing

              startActivity(myIntent);
              finish();
            }
          });
    }
  }