Example usage for android.os Handler Handler

List of usage examples for android.os Handler Handler

Introduction

In this page you can find the example usage for android.os Handler Handler.

Prototype

public Handler() 

Source Link

Document

Default constructor associates this handler with the Looper for the current thread.

Usage

From source file:com.cranberrygame.phonegap.plugin.ad.Util.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void addEvent() {
    //http://stackoverflow.com/questions/24539578/cordova-plugin-listening-to-device-orientation-change-is-it-possible
    //http://developer.android.com/reference/android/view/View.OnLayoutChangeListener.html
    //https://gitshell.com/lvxudong/A530_packages_app_Camera/blob/master/src/com/android/camera/ActivityBase.java
    webView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override//from   www .java  2  s  .com
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
                int oldRight, int oldBottom) {
            if (left == oldLeft && top == oldTop && right == oldRight && bottom == oldBottom) {
                return;
            }

            Log.d("Admob", "onLayoutChange");
            //Util.alert(cordova.getActivity(), "onLayoutChange");

            if (size != null && size.equals("SMART_BANNER")) {

                //http://stackoverflow.com/questions/11281562/android-admob-resize-on-landscape
                if (bannerView != null) {
                    RelativeLayout bannerViewLayout = (RelativeLayout) bannerView.getParent();
                    //if banner is showing
                    if (bannerViewLayout != null) {
                        //bannerViewLayout.removeView(bannerView);
                        Log.d("Admob", String.format("position: %s, size: %s", position, size));
                        //Util.alert(cordova.getActivity(), String.format("position: %s, size: %s", position, size));

                        //http://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay-in-android
                        final Handler handler = new Handler();
                        handler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                _showBannerAd(position, size);
                            }
                        }, 1);//after 1ms
                    }
                }
            }
        }
    });
}

From source file:foam.jellyfish.StarwispBuilder.java

public StarwispBuilder(Scheme scm) {
    m_Scheme = scm;
    m_NetworkManager = new NetworkManager();
    m_Handler = new Handler();
}

From source file:org.solovyev.android.samples.http.SamplesHttpActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.acl_http_layout);

    // should be one instance in application if several threads are working with it
    this.imageLoader = new CachingImageLoader(this, "acl-samples", new Handler());

    final List<HttpListItem> listItems = new ArrayList<HttpListItem>();
    for (String imageName : imageNames) {
        listItems.add(new HttpListItem(uriPrefix + imageName, this.imageLoader));
    }/*from w  ww  .  j a  v  a 2s .co  m*/
    ListItemAdapter.createAndAttach(this, listItems);

    final Button fetchDataButton = (Button) findViewById(R.id.fetch_data_button);
    fetchDataButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new CommonAsyncTask<String, Void, String>(SamplesHttpActivity.this) {

                @Override
                protected String doWork(@Nonnull List<String> strings) {
                    assert strings.size() == 1;
                    try {
                        return HttpTransactions.execute(new FetchHttpData(strings.get(0)));
                    } catch (IOException e) {
                        throwException(e);
                    }

                    return "";
                }

                @Override
                protected void onSuccessPostExecute(@Nullable final String result) {
                    final Activity activity = (Activity) getContext();
                    Threads.tryRunOnUiThread(activity, new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(activity, getString(R.string.acl_http_response) + " " + result,
                                    Toast.LENGTH_SHORT).show();
                        }
                    });
                }

                @Override
                protected void onFailurePostExecute(@Nonnull final Exception e) {
                    final Activity activity = (Activity) getContext();
                    Threads.tryRunOnUiThread(activity, new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }.execute(fetchDataUri);
        }
    });
}

From source file:com.google.appinventor.components.runtime.BlockyTalky.java

/**
 * Creates a new BlockyTalky component./*from   www  . ja v a2s .  c  om*/
 */
public BlockyTalky(ComponentContainer container) {
    super(container.$form());
    androidUIHandler = new Handler();

    localBTs = new ConcurrentHashMap<String, LocalBTData>();
    headers = new HashMap<String, String>() {
        {
            put("Sec-WebSocket-Protocol", "echo-protocol");
        }
    };
    handler = new Handler();
    announcerHandler = new Handler();
    Log.d(LOG_TAG, "Done with BlockyTalky constructor.");
    String addr = getIPAddress(true);
    if (addr.equals("")) {
        addr = getIPAddress(false);
    }

    try {
        mContext = container.$context();
        InetAddress ip = InetAddress.getByName(addr); //Android ip
        InetAddress bip = InetAddress.getByName(MULTICAST_ADDRESS);
        ds = new DatagramSocket(UNICAST_PORT);
        //ds.setReuseAddress(true);
        broadcastSocket = new MulticastSocket(MULTICAST_PORT);
        broadcastSocket.joinGroup(bip);
        broadcastSocket.setBroadcast(true);
        MessageListener listener = new MessageListener();
        Thread listenerThread = new Thread(listener);
        listenerThread.start();
        BroadcastListener broadcastListener = new BroadcastListener();
        Thread broadcastThread = new Thread(broadcastListener);
        broadcastThread.start();
        aquireMulticastLock();
        BroadcastAnnouncer announcer = new BroadcastAnnouncer();
        Thread announcerThread = new Thread(announcer);
        announcerThread.start();
    } catch (SocketException e) {
        Log.d(LOG_TAG,
                "Caught SocketException while trying to initialize BlockyTalky messaging: " + e.getMessage());
        e.printStackTrace();
    } catch (UnknownHostException e) {
        Log.d(LOG_TAG, "Caught UnknownHostException while trying to reach Blockytalky messaging router: "
                + e.getMessage());
    } catch (Exception e) {
        Log.d(LOG_TAG, "Exception while initializing BlockyTalky messaging: " + e);
        e.printStackTrace();
    }
    connectToMessagingRouter();

}

From source file:com.zia.freshdocs.widget.CMISAdapter.java

/**
 * Handles connecting to the host, get host info such as version and then displays
 * the Company Home contents.//from w  ww  .j  a va2 s . c  om
 */
public void home() {
    startProgressDlg(true);

    _dlThread = new ChildDownloadThread(new Handler() {
        public void handleMessage(Message msg) {
            // Save reference to current entry
            _stack.clear();

            NodeRef[] companyHome = (NodeRef[]) _dlThread.getResult();

            if (companyHome != null) {
                dismissProgressDlg();

                // Get Company Home children
                _currentState = new Pair<String, NodeRef[]>("", companyHome);
                populateList(companyHome);
            } else {
                CMISApplication app = (CMISApplication) getContext().getApplicationContext();
                app.handleNetworkStatus();
            }
        }
    }, new Downloadable() {
        public Object execute() {
            return _cmis.getCompanyHome();
        }
    });
    _dlThread.start();
}

From source file:com.yayandroid.utility.MapHelperFragment.java

/**
 * This method needs to be set as latest, because this method launches a
 * thread, which is intended to find mapView and to notify when it is able
 * or unable to find one//from w ww .  j  a  v a  2 s .c  o  m
 */
public void setMapFragment(SupportMapFragment mapFrag) {
    this.mapFragment = mapFrag;
    this.delayHandler = new Handler();
    CheckMap();
}

From source file:com.jelly.music.player.LauncherActivity.LauncherActivity.java

@SuppressLint("NewApi")
@Override//from  w ww .  j av a  2 s .c o  m
public void onCreate(Bundle savedInstanceState) {

    Parse.initialize(this, "aZiGV1G02m1Mj3SaaD9riuyrucDclK7abpc2Ibz3",
            "eCPoMrWrFnnHPVmBbDDIAFAMTA5EJLgtHLS2U9St");
    Map<String, String> dimensions = new HashMap<String, String>();
    // What type of news is this?
    dimensions.put("category", "politics");
    // Is it a weekday or the weekend?
    dimensions.put("dayType", "weekday");
    // Send the dimensions to Parse along with the 'read' event

    ParseAnalytics.trackEvent("read", dimensions);

    setTheme(R.style.AppThemeNoActionBar);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_launcher);

    mContext = this;
    mActivity = this;
    mApp = (Common) mContext.getApplicationContext();
    mHandler = new Handler();

    //Increment the start count. This value will be used to determine when the library should be rescanned.
    int startCount = mApp.getSharedPreferences().getInt("START_COUNT", 1);
    mApp.getSharedPreferences().edit().putInt("START_COUNT", startCount + 1).commit();

    //Save the dimensions of the layout for later use on KitKat devices.
    final RelativeLayout launcherRootView = (RelativeLayout) findViewById(R.id.launcher_root_view);
    launcherRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {

            try {

                int screenDimens[] = new int[2];
                int screenHeight = 0;
                int screenWidth = 0;
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
                    //API levels 14, 15 and 16.
                    screenDimens = getTrueDeviceResolution();
                    screenWidth = screenDimens[0];
                    screenHeight = screenDimens[1];

                } else {
                    //API levels 17+.
                    Display display = getWindowManager().getDefaultDisplay();
                    DisplayMetrics metrics = new DisplayMetrics();
                    display.getRealMetrics(metrics);
                    screenHeight = metrics.heightPixels;
                    screenWidth = metrics.widthPixels;

                }

                int layoutHeight = launcherRootView.getHeight();
                int layoutWidth = launcherRootView.getWidth();

                int extraHeight = screenHeight - layoutHeight;
                int extraWidth = screenWidth = layoutWidth;

                mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT", layoutHeight).commit();
                mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH", layoutWidth).commit();
                mApp.getSharedPreferences().edit().putInt("KITKAT_HEIGHT_LAND", layoutWidth - extraHeight)
                        .commit();
                mApp.getSharedPreferences().edit().putInt("KITKAT_WIDTH_LAND", screenHeight).commit();

            } catch (Exception e) {
                e.printStackTrace();
            }

        }

    });

    //Build the music library based on the user's scan frequency preferences.
    int scanFrequency = mApp.getSharedPreferences().getInt("SCAN_FREQUENCY", 5);
    int updatedStartCount = mApp.getSharedPreferences().getInt("START_COUNT", 1);

    //Launch the appropriate activity based on the "FIRST RUN" flag.
    if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true) {

        //Create the default Playlists directory if it doesn't exist.
        File playlistsDirectory = new File(Environment.getExternalStorageDirectory() + "/Playlists/");
        if (!playlistsDirectory.exists() || !playlistsDirectory.isDirectory()) {
            playlistsDirectory.mkdir();
        }

        //Disable equalizer for HTC devices by default.
        if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true
                && Build.PRODUCT.contains("HTC")) {
            mApp.getSharedPreferences().edit().putBoolean("EQUALIZER_ENABLED", false).commit();
        }

        //Send out a test broadcast to initialize the homescreen/lockscreen widgets.
        sendBroadcast(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));

        Intent intent = new Intent(this, WelcomeActivity.class);
        startActivity(intent);
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);

    } else if (mApp.isBuildingLibrary()) {
        buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text);
        buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info);
        buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout);

        buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
        buildingLibraryInfoText.setPaintFlags(
                buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

        buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
        buildingLibraryMainText.setPaintFlags(
                buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

        buildingLibraryMainText.setText(R.string.jams_is_building_library);
        buildingLibraryLayout.setVisibility(View.VISIBLE);

        //Initialize the runnable that will fire once the scan process is complete.
        mHandler.post(scanFinishedCheckerRunnable);

    } else if (mApp.getSharedPreferences().getBoolean("RESCAN_ALBUM_ART", false) == true) {

        buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text);
        buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info);
        buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout);

        buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
        buildingLibraryInfoText.setPaintFlags(
                buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

        buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
        buildingLibraryMainText.setPaintFlags(
                buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

        buildingLibraryMainText.setText(R.string.jams_is_caching_artwork);
        initScanProcess(0);

    } else if ((mApp.getSharedPreferences().getBoolean("REBUILD_LIBRARY", false) == true)
            || (scanFrequency == 0 && mApp.isScanFinished() == false)
            || (scanFrequency == 1 && mApp.isScanFinished() == false && updatedStartCount % 3 == 0)
            || (scanFrequency == 2 && mApp.isScanFinished() == false && updatedStartCount % 5 == 0)
            || (scanFrequency == 3 && mApp.isScanFinished() == false && updatedStartCount % 10 == 0)
            || (scanFrequency == 4 && mApp.isScanFinished() == false && updatedStartCount % 20 == 0)) {

        buildingLibraryMainText = (TextView) findViewById(R.id.building_music_library_text);
        buildingLibraryInfoText = (TextView) findViewById(R.id.building_music_library_info);
        buildingLibraryLayout = (RelativeLayout) findViewById(R.id.building_music_library_layout);

        buildingLibraryInfoText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
        buildingLibraryInfoText.setPaintFlags(
                buildingLibraryInfoText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

        buildingLibraryMainText.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light"));
        buildingLibraryMainText.setPaintFlags(
                buildingLibraryMainText.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

        initScanProcess(1);

    } else {

        //Check if this activity was called from Settings.
        if (getIntent().hasExtra("UPGRADE")) {
            if (getIntent().getExtras().getBoolean("UPGRADE") == true) {
                mExplicitShowTrialFragment = true;
            } else {
                mExplicitShowTrialFragment = false;
            }

        }

        //initInAppBilling();
        launchMainActivity();
    }

    //Fire away a report to Google Analytics.
    try {
        if (mApp.isGoogleAnalyticsEnabled() == true) {
            EasyTracker easyTracker = EasyTracker.getInstance(this);
            easyTracker.send(MapBuilder.createEvent("Jelly startup.", // Event category (required)
                    "User started Jelly.", // Event action (required)
                    "User started Jelly.", // Event label
                    null) // Event value
                    .build());
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.safecell.ManageProfile_Activity.java

void handleMessageFromThread() {
    handler = new Handler() {

        @Override//from ww  w  .  j  av  a2 s.  c o m
        public void handleMessage(Message msg) {
            // TODO Auto-generated method stub
            super.handleMessage(msg);
            licenseProgressDialog.dismiss();

            if (licensekeyString == null) {
                message = getLicenseKey.getFailureMessage();
                UIUtils.OkDialog(context, message);
                licenseThread = new LicenseThread();
            }
            selectLicenseFromDialog();

            if (licenseThread.isAlive()) {

                licenseThread = new LicenseThread();

            }
        }
    };
}

From source file:net.homelinux.penecoptero.android.citybikes.app.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from w w  w  . j  a va2s .c  om
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    mapView = (MapView) findViewById(R.id.mapview);
    mSlidingDrawer = (StationSlidingDrawer) findViewById(R.id.drawer);
    infoLayer = (InfoLayer) findViewById(R.id.info_layer);
    scale = getResources().getDisplayMetrics().density;
    //Log.i("CityBikes","ON CREATEEEEEEEEE!!!!!");
    infoLayerPopulator = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == InfoLayer.POPULATE) {
                infoLayer.inflateStation(stations.getCurrent());

            }
            if (msg.what == CityBikes.BOOKMARK_CHANGE) {
                int id = msg.arg1;
                boolean bookmarked;
                if (msg.arg2 == 0) {
                    bookmarked = false;
                } else {
                    bookmarked = true;
                }
                StationOverlay station = stations.getById(id);
                try {
                    BookmarkManager bm = new BookmarkManager(getApplicationContext());
                    bm.setBookmarked(station.getStation(), !bookmarked);
                } catch (Exception e) {
                    Log.i("CityBikes", "Error bookmarking station");
                    e.printStackTrace();
                }

                if (!view_all) {
                    view_near();
                }
                mapView.postInvalidate();
            }
        }
    };

    infoLayer.setHandler(infoLayerPopulator);
    RelativeLayout.LayoutParams zoomControlsLayoutParams = new RelativeLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
    zoomControlsLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    zoomControlsLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);

    mapView.addView(mapView.getZoomControls(), zoomControlsLayoutParams);

    modeButton = (ToggleButton) findViewById(R.id.mode_button);

    modeButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMode(!getBike);
        }

    });

    applyMapViewLongPressListener(mapView);

    settings = getSharedPreferences(CityBikes.PREFERENCES_NAME, 0);

    List<Overlay> mapOverlays = mapView.getOverlays();

    locator = new Locator(this, new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == Locator.LOCATION_CHANGED) {
                GeoPoint point = new GeoPoint(msg.arg1, msg.arg2);
                hOverlay.moveCenter(point);
                mapView.getController().animateTo(point);
                mDbHelper.setCenter(point);
                // Location has changed
                try {
                    mDbHelper.updateDistances(point);
                    infoLayer.update();
                    if (!view_all) {
                        view_near();
                    }
                } catch (Exception e) {

                }
                ;
            }
        }
    });

    hOverlay = new HomeOverlay(locator.getCurrentGeoPoint(), new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == HomeOverlay.MOTION_CIRCLE_STOP) {
                try {
                    if (!view_all) {
                        view_near();
                    }
                    mapView.postInvalidate();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    });

    stations = new StationOverlayList(mapOverlays, new Handler() {
        @Override
        public void handleMessage(Message msg) {
            //Log.i("CityBikes","Message: "+Integer.toString(msg.what)+" "+Integer.toString(msg.arg1));
            if (msg.what == StationOverlay.TOUCHED && msg.arg1 != -1) {
                // One station has been touched
                stations.setCurrent(msg.arg1, getBike);
                infoLayer.inflateStation(stations.getCurrent());
                //Log.i("CityBikes","Station touched: "+Integer.toString(msg.arg1));
            }
        }
    });

    stations.addOverlay(hOverlay);

    mNDBAdapter = new NetworksDBAdapter(getApplicationContext());

    mDbHelper = new StationsDBAdapter(this, mapView, new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case StationsDBAdapter.FETCH:
                break;
            case StationsDBAdapter.UPDATE_MAP:
                progressDialog.dismiss();
                SharedPreferences.Editor editor = settings.edit();
                editor.putBoolean("reload_network", false);
                editor.commit();
            case StationsDBAdapter.UPDATE_DATABASE:
                StationOverlay current = stations.getCurrent();
                if (current == null) {
                    infoLayer.inflateMessage(getString(R.string.no_bikes_around));
                }
                if (current != null) {
                    infoLayer.inflateStation(current);
                    if (view_all)
                        view_all();
                    else
                        view_near();
                } else {

                }
                mapView.invalidate();
                infoLayer.update();
                ////Log.i("openBicing", "Database updated");
                break;
            case StationsDBAdapter.NETWORK_ERROR:
                ////Log.i("openBicing", "Network error, last update from " + mDbHelper.getLastUpdated());
                Toast toast = Toast.makeText(getApplicationContext(),
                        getString(R.string.network_error) + " " + mDbHelper.getLastUpdated(),
                        Toast.LENGTH_LONG);
                toast.show();
                break;
            }
        }
    }, stations);

    mDbHelper.setCenter(locator.getCurrentGeoPoint());

    mSlidingDrawer.setHandler(new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case StationSlidingDrawer.ITEMCLICKED:
                StationOverlay clicked = (StationOverlay) msg.obj;
                stations.setCurrent(msg.arg1, getBike);
                Message tmp = new Message();
                tmp.what = InfoLayer.POPULATE;
                tmp.arg1 = msg.arg1;
                infoLayerPopulator.dispatchMessage(tmp);
                mapView.getController().animateTo(clicked.getCenter());
            }
        }
    });

    if (savedInstanceState != null) {
        locator.unlockCenter();
        hOverlay.setRadius(savedInstanceState.getInt("homeRadius"));
        this.view_all = savedInstanceState.getBoolean("view_all");
    } else {
        updateHome();
    }

    try {
        mDbHelper.loadStations();
        if (savedInstanceState == null) {
            String strUpdated = mDbHelper.getLastUpdated();

            Boolean dirty = settings.getBoolean("reload_network", false);

            if (strUpdated == null || dirty) {
                this.fillData(view_all);
            } else {
                Toast toast = Toast.makeText(this.getApplicationContext(),
                        "Last Updated: " + mDbHelper.getLastUpdated(), Toast.LENGTH_LONG);
                toast.show();
                Calendar cal = Calendar.getInstance();
                long now = cal.getTime().getTime();
                if (Math.abs(now - mDbHelper.getLastUpdatedTime()) > 60000 * 5)
                    this.fillData(view_all);
            }
        }

    } catch (Exception e) {
        ////Log.i("openBicing", "SHIT ... SUCKS");
    }
    ;

    if (view_all)
        view_all();
    else
        view_near();
    ////Log.i("openBicing", "CREATE!");
}