android - How to access variable defined in onCreate in onCreateView -


I am trying to access the declared variable "adapter" in the onCreate section in the onCreateView section. This is a list every time I check out the content on it, then empty it.

Here is the code

  package com.example.beacon; Import java.util.list; Import com.estimote.sdk.beacon; Import com.estimote.sdk.BeaconManager; Import com.estimote.sdk.Region; Import android.app.Fragment; Importroid.os.Bundle; Android Import Remote option; Import android.util.log; Import android.view.LayoutInflater; Import android.view.View; Import android.view.ViewGroup; Import android.widget.TextView; Public squared frigatebicon piece {Private constant final string TAG = main activity. Class.getSample name (); Private static final string ESTIMOTE_PROXIMITY_UUID = "B9407F30-F5F8-466E-AFF9-25556B57FE6D"; Private static final area ALL_ESTIMOTE_BEACONS = new area ("regional", ESTIMOTE_PROXIMITY_UUID, empty, empty); Private Beacon Manager Beacon Manager; Public LeDeviceListAdapter adapter = null; // & amp; Lt; ---- Crete on this convertible public vacuum (bundled saved instenstate) {super.onCreate (savedInstanceState); Adapter = new ledislist adapter (getActivity ()); Beacon Manager = New Beacon Manager (getActivity ()); The beaconManager.setRangingListener (New BeaconManager.RangingListener () {@Override public void onBeaconsDiscovered (field list & lt; Beacon & gt; beacon) {Log.d (TAG, "the Beacon FB_onCreate:" + beacon); adapter. ReplaceWith (beacon); // & lt; ---- this variable log D. (Tag, "found adapter:" + adapter.getCount ());}}); beaconManager.connect (New BeaconManager.ServiceReadyCallback () can not start {@Override public void onServiceReady () to {try {beaconManager.startRanging (ALL_ESTIMOTE_BEACONS); ,,} catch (RemoteException e) {Log.e ( "tag" E );}}}); } @ See override public Kriattiwu (layout Inflettr Infletr, View Group container, bundle saved Instensstet) {Beacon Manejrkknekt (New Beacon manager. Service Reedi callback () {@ Override public wide on Service Ridi () ({Beacon manager. starting Arnging (Ol_ ESTIMOTE_BEACONS)}} catch (Rimotakssteshn e) {log. a (tags, "can not start", e);}}}); log d. (tags, found "adapter 2" + adapter. Gatecount ()); //  

When I run it on the beacon, it turns out that the count is! = 0 which is correct. But somewhere else it's always 0.

It is I would have to use a bundle from the same piece inside. As the SIM was told: "The after-text" itempop = "text">

This onBeaconsDiscovered in onCreateView has not been invited yet to be accurate, this default starts once per second (according to Estimote SDK docs). And that's why you count ===================================== You need to update the UI


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -