Example usage for android.os Message Message

List of usage examples for android.os Message Message

Introduction

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

Prototype

public Message() 

Source Link

Document

Constructor (but the preferred way to get a Message is to call #obtain() Message.obtain() ).

Usage

From source file:it.angrydroids.epub3reader.TextSelectionSupport.java

@Override
public boolean onLongClick(View v) {

    if (!isInSelectionMode()) {
        mWebView.loadUrl("javascript:android.selection.longTouch();");
        mScrolling = true;/*from  w  ww  . j  a  v a  2  s.  co  m*/
    }
    Message msg = new Message();
    msg.setTarget(new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            String url = msg.getData().getString("url");
            if (url != null)
                navigator.setNote(url, index);
        }
    });
    mWebView.requestFocusNodeHref(msg);
    return true;
}

From source file:com.sabdroidex.controllers.couchpotato.CouchPotatoController.java

/**
 * Retrieve possible download profiles from CouchPotato
 * /*from w w  w.  j  av a  2s .c  om*/
 * @param messageHandler Handler
 */
public synchronized static void getStatusList(final Handler messageHandler) {
    if (executingCommand || "".equals(Preferences.get(Preferences.COUCHPOTATO_URL))) {
        return;
    }

    Thread thread = new Thread() {

        @Override
        public void run() {
            try {
                String result = makeApiCall(MESSAGE.STATUS_LIST.toString().toLowerCase());

                JSONObject jsonObject = new JSONObject(result);

                if (jsonObject.getBoolean("success")) {
                    JSONArray profileList = jsonObject.getJSONArray("list");
                    status = new HashMap<Integer, String>();
                    for (int i = 0; i < profileList.length(); i++) {
                        status.put(profileList.getJSONObject(i).getInt("id"),
                                profileList.getJSONObject(i).getString("label"));
                    }

                    Message message = new Message();
                    message.setTarget(messageHandler);
                    message.what = MESSAGE.PROFILE_LIST.hashCode();
                    message.obj = status;
                    message.sendToTarget();
                }
            } catch (IOException e) {
                Log.w(TAG, " " + e.getLocalizedMessage());
            } catch (Throwable e) {
                Log.w(TAG, " " + e.getLocalizedMessage());
            } finally {
                executingCommand = false;
            }
        }
    };
    executingCommand = true;
    thread.start();
}

From source file:net.networksaremadeofstring.rhybudd.ViewZenossDeviceListFragment.java

public void Refresh() {
    try {/*from  w  w  w. j  a va  2s  .c o  m*/
        if (null != dialog) {
            dialog.setTitle("Contacting Zenoss...");
            dialog.setMessage("Please wait:\nLoading Infrastructure....");
            //TODO make cancelable
            dialog.setCancelable(true);

            if (!dialog.isShowing()) {
                dialog.show();
            }
        } else {
            dialog = new ProgressDialog(getActivity());
            dialog.setTitle("Contacting Zenoss...");
            dialog.setMessage("Please wait:\nLoading Infrastructure....");
            dialog.setCancelable(false);
            dialog.show();
        }
    } catch (Exception e) {
        BugSenseHandler.sendExceptionMessage("ViewZenossDeviceListFragment", "Refresh", e);
    }

    if (listOfDevices != null)
        listOfDevices.clear();

    ((Thread) new Thread() {
        public void run() {
            String MessageExtra = "";
            try {
                Message msg = new Message();
                Bundle bundle = new Bundle();

                /*ZenossAPI API = null;
                SharedPreferences settings = null;
                settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
                try
                {
                API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""));
                        
                }
                catch(ConnectTimeoutException cte)
                {
                if(cte.getMessage() != null)
                {
                        
                    bundle.putString("exception","The connection timed out;\r\n" + cte.getMessage().toString());
                    msg.setData(bundle);
                    msg.what = 0;
                    handler.sendMessage(msg);
                    //Toast.makeText(DeviceList.this, "The connection timed out;\r\n" + cte.getMessage().toString(), Toast.LENGTH_LONG).show();
                }
                else
                {
                    bundle.putString("exception","A time out error was encountered but the exception thrown contains no further information.");
                    msg.setData(bundle);
                    msg.what = 0;
                    handler.sendMessage(msg);
                    //Toast.makeText(DeviceList.this, "A time out error was encountered but the exception thrown contains no further information.", Toast.LENGTH_LONG).show();
                }
                }
                catch(Exception e)
                {
                if(e.getMessage() != null)
                {
                    bundle.putString("exception","An error was encountered;\r\n" + e.getMessage().toString());
                    msg.setData(bundle);
                    msg.what = 0;
                    handler.sendMessage(msg);
                    //Toast.makeText(DeviceList.this, "An error was encountered;\r\n" + e.getMessage().toString(), Toast.LENGTH_LONG).show();
                }
                else
                {
                    bundle.putString("exception","An error was encountered but the exception thrown contains no further information.");
                    msg.setData(bundle);
                    msg.what = 0;
                    handler.sendMessage(msg);
                    //Toast.makeText(DeviceList.this, "An error was encountered but the exception thrown contains no further information.", Toast.LENGTH_LONG).show();
                }
                }*/

                if (null == mService || !mBound) {
                    //Log.e("Refresh","Service was dead or something so sleeping");
                    try {
                        sleep(500);
                    } catch (Exception e) {
                        BugSenseHandler.sendExceptionMessage("ViewZenossDeviceListFragment",
                                "RefreshThreadSleep", e);
                    }
                }

                if (null == mService || !mBound) {
                    bundle.putString("exception",
                            "There was an error binding to the Rhybudd internal service to query the API. Try pressing refresh.");
                    msg.setData(bundle);
                    msg.what = 0;
                    handler.sendMessage(msg);
                } else {
                    try {

                        if (null == mService.API) {
                            mService.PrepAPI(true, true);
                        }

                        ZenossCredentials credentials = new ZenossCredentials(getActivity());

                        if (mService.API.Login(credentials)) {
                            listOfDevices = mService.API.GetRhybuddDevices();
                        }

                        /*if(API != null)
                        {
                        listOfDevices = API.GetRhybuddDevices();
                        }*/
                        else {
                            listOfDevices = null;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        if (e.getMessage() != null)
                            MessageExtra = e.getMessage();

                        listOfDevices = null;
                    }

                    if (null != listOfDevices && listOfDevices.size() > 0) {
                        PopulateMetaLists();

                        //DeviceCount = listOfZenossDevices.size();
                        Message.obtain();
                        handler.sendEmptyMessage(1);

                        RhybuddDataSource datasource = new RhybuddDataSource(getActivity());
                        datasource.open();
                        datasource.UpdateRhybuddDevices(listOfDevices);
                        datasource.close();
                    } else {
                        //Message msg = new Message();
                        //Bundle bundle = new Bundle();
                        bundle.putString("exception",
                                "A query to both the local DB and Zenoss API returned no devices. "
                                        + MessageExtra);
                        msg.setData(bundle);
                        msg.what = 0;
                        handler.sendMessage(msg);
                    }

                }
            } catch (Exception e) {
                BugSenseHandler.sendExceptionMessage("ViewZenossDeviceListFragment", "DBGetThread", e);
                //BugSenseHandler.log("DeviceList", e);
                Message msg = new Message();
                Bundle bundle = new Bundle();
                bundle.putString("exception", e.getMessage());
                msg.setData(bundle);
                msg.what = 0;
                handler.sendMessage(msg);
            }
        }
    }).start();
}

From source file:net.evecom.androidecssp.activity.event.ContinueInfoActivity.java

/**
 * //from w  ww.  jav a2  s  .  c  om
 * 
 * 
 * @author Stark Zhou
 * @created 2015-12-30 3:04:25
 */
private void getMonitor() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Message message = new Message();
            try {
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("continueid", continueInfo.getStr("id"));
                map.put("eventid", eventInfo.getStr("id"));
                resultArray = connServerForResultPost("jfs/ecssp/mobile/eventContinueCtr/getContinueMonitor",
                        map);
            } catch (ClientProtocolException e) {
                message.what = MESSAGETYPE_02;
            } catch (IOException e) {
                message.what = MESSAGETYPE_02;
            }
            if (resultArray.length() > 0) {
                try {
                    monitor = getObjsInfo(resultArray);
                    if (null == monitor) {
                        message.what = MESSAGETYPE_02;
                    } else {
                        message.what = MESSAGETYPE_01;
                    }
                } catch (JSONException e) {
                    message.what = MESSAGETYPE_02;
                }
            } else {
                message.what = MESSAGETYPE_02;
            }
            monitorHandler.sendMessage(message);
        }
    }).start();
}

From source file:com.nextgis.mobile.map.RemoteTMSLayer.java

protected static void create(final MapBase map, String layerName, String layerUrl, int tmsType) {
    String sErr = map.getContext().getString(R.string.error_occurred);
    try {//  w  w  w.j  a v a 2  s  . c  o  m
        File outputPath = map.cretateLayerStorage();
        //create layer description file
        JSONObject oJSONRoot = new JSONObject();
        oJSONRoot.put(JSON_NAME_KEY, layerName);
        oJSONRoot.put(JSON_URL_KEY, layerUrl);
        oJSONRoot.put(JSON_VISIBILITY_KEY, true);
        oJSONRoot.put(JSON_TYPE_KEY, LAYERTYPE_TMS);
        oJSONRoot.put(JSON_TMSTYPE_KEY, tmsType);

        //send message to handler to show error or add new layer

        File file = new File(outputPath, LAYER_CONFIG);
        FileUtil.createDir(outputPath);
        FileUtil.writeToFile(file, oJSONRoot.toString());

        if (map.getMapEventsHandler() != null) {
            Bundle bundle = new Bundle();
            bundle.putBoolean(BUNDLE_HASERROR_KEY, false);
            bundle.putString(BUNDLE_MSG_KEY, map.getContext().getString(R.string.message_layer_added));
            bundle.putInt(BUNDLE_TYPE_KEY, MSGTYPE_LAYER_ADDED);
            bundle.putSerializable(BUNDLE_PATH_KEY, outputPath);

            Message msg = new Message();
            msg.setData(bundle);
            map.getMapEventsHandler().sendMessage(msg);
        }
        return;

    } catch (FileNotFoundException e) {
        Log.d(TAG, "Exception: " + e.getLocalizedMessage());
        sErr += ": " + e.getLocalizedMessage();
    } catch (JSONException e) {
        Log.d(TAG, "Exception: " + e.getLocalizedMessage());
        sErr += ": " + e.getLocalizedMessage();
    } catch (IOException e) {
        Log.d(TAG, "Exception: " + e.getLocalizedMessage());
        sErr += ": " + e.getLocalizedMessage();
    }
    //if we here something wrong occurred
    Toast.makeText(map.getContext(), sErr, Toast.LENGTH_SHORT).show();
}

From source file:net.evecom.androidecssp.activity.EventAddActivity.java

/**
 * //from ww  w  .  ja  v  a2  s  . c  o m
 *  postdata
 * @author Mars zhang
 * @created 2015-11-10 4:13:51
 * @param entity
 */
private void postdata(final HashMap<String, String> entity) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Message message = new Message();
            try {
                saveResult = connServerForResultPost("jfs/ecssp/mobile/eventCtr/EventAdd", entity);
            } catch (ClientProtocolException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            } catch (IOException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            }
            if (saveResult.length() > 0) {
                message.what = MESSAGETYPE_01;
                String eventId = "";
                try {
                    BaseModel eventInfo = getObjInfo(saveResult);
                    if (null != eventInfo) {
                        eventId = eventInfo.get("id");
                    }
                } catch (JSONException e) {
                    Log.e("mars", e.getMessage());
                }
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("eventId", eventId);
                postImage(map, fileList, "jfs/ecssp/mobile/eventCtr/eventFileSave");
            } else {
                message.what = MESSAGETYPE_02;
            }
            Log.v("mars", saveResult);
            saveHandler.sendMessage(message);
        }
    }).start();
}

From source file:dk.kk.ibikecphlib.util.HttpUtils.java

public static Message JSONtoMessage(JsonNode result) {
    Message ret = new Message();
    Bundle data = new Bundle();
    if (result != null) {
        if (result.has("success"))
            data.putBoolean("success", result.get("success").asBoolean());
        if (result.has("info"))
            data.putString("info", result.get("info").asText());
        if (result.has("has_password"))
            data.putBoolean("has_password", result.get("has_password").asBoolean());
        if (result.has("invalid_token")) {
            if (result.get("invalid_token").asBoolean()) {
                data.putBoolean("invalid_token", result.get("invalid_token").asBoolean());
                IBikeApplication.logoutWrongToken();
            }/*from ww  w. jav a2  s  .  co  m*/
        }
        /*if (result.has("errors"))
        data.putString("errors", result.get("errors").get(0).asText());*/
    }
    if (result != null && result.has("data")) {
        JsonNode dataNode = result.get("data");
        if (dataNode != null) {
            if (dataNode.has("id"))
                data.putInt("id", dataNode.get("id").asInt());
            if (dataNode.has("auth_token"))
                data.putString("auth_token", dataNode.get("auth_token").asText());
            if (dataNode.has("signature"))
                data.putString("signature", dataNode.get("signature").asText());
            if (dataNode.has("provider"))
                data.putString("provider", dataNode.get("provider").asText());
            /*if (dataNode.has("errors"))
                data.putString("errors", dataNode.get("errors").get(0).asText());*/
        }
    }

    ret.setData(data);
    return ret;
}

From source file:cm.aptoide.pt.ManageRepo.java

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {

    LayoutInflater li = LayoutInflater.from(this);

    switch (item.getItemId()) {
    case ADD_REPO:
        View view = li.inflate(R.layout.addrepo, null);

        final TextView sec_msg = (TextView) view.findViewById(R.id.sec_msg);
        final TextView sec_msg2 = (TextView) view.findViewById(R.id.sec_msg2);

        final EditText sec_user = (EditText) view.findViewById(R.id.sec_user);
        final EditText sec_pwd = (EditText) view.findViewById(R.id.sec_pwd);

        final CheckBox sec = (CheckBox) view.findViewById(R.id.secure_chk);
        sec.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    sec_user.setEnabled(true);
                    sec_pwd.setEnabled(true);
                } else {
                    sec_user.setEnabled(false);
                    sec_pwd.setEnabled(false);
                }//from  w w w.  j  a v  a 2s .  c  o  m
            }
        });

        Builder p = new AlertDialog.Builder(this).setView(view);
        alrt = p.create();
        alrt.setIcon(android.R.drawable.ic_menu_add);
        alrt.setTitle("Add new repository");

        alrt.setButton("Add", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                Message msg = new Message();
                EditText uri = (EditText) alrt.findViewById(R.id.edit_uri);
                String uri_str = uri.getText().toString();
                sec_msg.setVisibility(View.GONE);
                sec_msg2.setVisibility(View.GONE);
                if (sec.isChecked()) {
                    String user = sec_user.getText().toString();
                    String pwd = sec_pwd.getText().toString();
                    int result = checkServer(uri_str, user, pwd);
                    if (result == 200) {
                        msg.obj = 0;
                        db.addServer(uri_str);
                        db.addLogin(user, pwd, uri_str);
                        change = true;
                        redraw();
                    } else if (result == 401) {
                        sec_msg2.setText("Login is wrong");
                        sec_msg2.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    } else {
                        sec_msg.setText("Can't connect to server");
                        sec_msg.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    }
                } else {
                    int result = checkServer(uri_str, null, null);
                    if (result == 200) {
                        msg.obj = 0;
                        db.addServer(uri_str);
                        change = true;
                        redraw();
                    } else if (result == 401) {
                        sec_msg2.setText("Login required");
                        sec_msg2.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    } else {
                        sec_msg.setText("Can't connect to server");
                        sec_msg.setVisibility(View.VISIBLE);
                        msg.obj = 1;
                    }
                }
                new_repo.sendMessage(msg);
            }
        });

        alrt.setButton2("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                alrt.dismiss();
            }
        });
        alrt.show();
        break;

    case REM_REPO:
        final Vector<String> rem_lst = new Vector<String>();
        CharSequence[] b = new CharSequence[server_lst.size()];
        for (int i = 0; i < server_lst.size(); i++) {
            b[i] = server_lst.get(i).uri;
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Chose repository to remove");
        builder.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
        builder.setMultiChoiceItems(b, null, new DialogInterface.OnMultiChoiceClickListener() {
            public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) {
                if (isChecked) {
                    rem_lst.addElement(server_lst.get(whichButton).uri);
                } else {
                    rem_lst.removeElement(server_lst.get(whichButton).uri);
                }
            }
        });
        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                db.removeServer(rem_lst);
                change = true;
                redraw();
            }
        });
        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                return;
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
        break;

    case EDIT_REPO:
        CharSequence[] b2 = new CharSequence[server_lst.size()];
        for (int i = 0; i < server_lst.size(); i++) {
            b2[i] = server_lst.get(i).uri;
        }

        AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
        builder2.setTitle("Chose repository to edit");
        builder2.setIcon(android.R.drawable.ic_menu_edit);
        builder2.setSingleChoiceItems(b2, -1, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                updt_repo = server_lst.get(which).uri;
            }
        });
        builder2.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                editRepo(updt_repo);
                return;
            }
        });
        builder2.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                return;
            }
        });
        alert2 = builder2.create();
        alert2.show();
        break;
    }
    return super.onMenuItemSelected(featureId, item);
}

From source file:com.watch.customer.ui.ShopListActivity.java

private void initRun() {
    // TODO Auto-generated method stub
    typelistRun = new Runnable() {
        @Override/*from   w  ww  .  jav  a2s .com*/
        public void run() {
            // TODO Auto-generated method stub
            String result = null;
            try {
                result = HttpUtil.get(HttpUtil.URL_TYPELIST);
            } catch (IOException e) {
                e.printStackTrace();
                result = e.getMessage();
            }
            Message msg = new Message();
            msg.what = typelist_what;
            msg.obj = result;
            mHandler.sendMessage(msg);
        }
    };
    ThreadPoolManager.getInstance().addTask(typelistRun);
    SearchBySec();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(REFRESH_CITY);
    registerReceiver(MyReceiver, intentFilter);
}

From source file:com.mk4droid.IMC_Activities.Fragment_Map.java

/**
 * //from  w w w .  j a v  a  2  s  . co m
 *                   On Resume 
 * 
 */
@Override
public void onResume() {
    super.onResume();

    //------------ Create Items on Maps -----------------------
    if (fmap_main == null) {
        fmap_main = SupportMapFragment.newInstance();
        FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.flmain, fmap_main);
        fragmentTransaction.commit();

        getChildFragmentManager().executePendingTransactions();
    }

    if (fmap_main != null)
        gmap = fmap_main.getMap();

    if (gmap != null) {
        gmap.setInfoWindowAdapter(new InfoWindowAdapterButtoned(getActivity()));
        gmap.setMyLocationEnabled(true);

        gmap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Service_Location.locUserPred.getLatitude(),
                Service_Location.locUserPred.getLongitude()), 14));
    }

    pbgeneral.bringToFront();

    //------- Button Maps Types  ------------
    btMaps = (ImageButton) vframelayout_main.findViewById(R.id.btMapChange);
    btRefresh = (ImageButton) vframelayout_main.findViewById(R.id.btRefresh);
    btMyIss = (ImageButton) vframelayout_main.findViewById(R.id.btFilterMineIssMap);

    btRefresh.bringToFront();

    btRefresh.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            //---- Show dialog Refresh ----------
            //            dialogRefresh = ProgressDialog.show(ctx, resources.getString(R.string.Downloading),
            //                  resources.getString(R.string.Refresh), true);

            // ------- Broadcast Refresh through a handler
            Message msg = new Message();
            msg.arg1 = 1;
            handlerBroadcastRefresh.sendMessage(msg);
        }
    });

    //------ set Handlers and Receivers ------
    HandlersAndReceivers();

    //------------------------------------------------------------      
    btMaps.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            //------------- Other maps views click --------
            String bt_Tag = btMaps.getTag().toString();
            if (bt_Tag.equals("Satellite")) {
                gmap.setMapType(MAP_TYPE_NORMAL);
                //btMaps.setText(resources.getString(R.string.NormalMap));
                btMaps.setTag("Normal");
            } else if (bt_Tag.equals("Normal")) {
                gmap.setMapType(MAP_TYPE_HYBRID);
                //btMaps.setText(resources.getString(R.string.Satellite));
                btMaps.setTag("Satellite");
            }
        }
    });

    btMaps.bringToFront();
    //--------------------------------------------------------------
    resources = SetResources(); // to get new UserID

    if (!isLocServBound)
        ctx.bindService(IntLocServ, mLocConnection, Context.BIND_AUTO_CREATE);

    //---------- Maps ------------
    String bt_Tag = btMaps.getTag().toString();

    if (bt_Tag.equals("Normal") && gmap != null) {
        gmap.setMapType(MAP_TYPE_NORMAL);
        btMaps.setTag("Normal");
    } else if (bt_Tag.equals("Satellite") && gmap != null) {
        gmap.setMapType(MAP_TYPE_HYBRID);
        btMaps.setTag("Satellite");
    }

    //-------------- Check if distance has changed -------------
    int distanceData = mshPrefs.getInt("distanceData", Constants_API.initRange);
    int distanceDataOLD = mshPrefs.getInt("distanceDataOLD", Constants_API.initRange);

    //---------- Check if IssuesNo has changed ---------
    int IssuesNoAR = Integer.parseInt(mshPrefs.getString("IssuesNoAR", "40"));
    int IssuesNoAROLD = Integer.parseInt(mshPrefs.getString("IssuesNoAROLD", "40"));

    if (InternetConnCheck.getInstance(ctx).isOnline(ctx)) {

        if (distanceData != distanceDataOLD) {
            // ------- Broadcast Refresh through a handle
            Message msg = new Message();
            msg.arg1 = 2;
            handlerBroadcastRefresh.sendMessage(msg);

        } else if (IssuesNoAR != IssuesNoAROLD) {
            // ------- Broadcast Refresh through a handle
            Message msg = new Message();
            msg.arg1 = 3;
            handlerBroadcastRefresh.sendMessage(msg);
        }
        btRefresh.setVisibility(View.VISIBLE);

    } else {
        btRefresh.setVisibility(View.GONE);
    }

    //-------------- BT myIssues -------
    btMyIss.bringToFront();

    if (UserRealName.length() == 0) {
        btMyIss.setVisibility(View.GONE);
    }

    if (MyIssuesSW)
        btMyIss.setImageResource(R.drawable.ic_my_issues_gray);
    else
        btMyIss.setImageResource(R.drawable.ic_all_issues_gray);

    btMyIss.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // Internal variables
            if (MyIssuesSW)
                MyIssuesSW = false;
            else
                MyIssuesSW = true;

            savePreferences("MyIssuesSW", MyIssuesSW, "boolean");

            // Button appearance
            if (MyIssuesSW)
                btMyIss.setImageResource(R.drawable.my_issues_icon_gray32);
            else
                btMyIss.setImageResource(R.drawable.all_issues_icon_gray32);

            // now update the markers visible
            Message msg = new Message();
            msg.arg1 = 2;
            handlerMarkersUPD.sendMessage(msg);

        }
    });

    //-------- Init markers  ---------
    Message msg = new Message();
    msg.arg1 = 1;
    handlerMarkersUPD.sendMessage(msg);
    //----------- Flurry Analytics --------
    if (mshPrefs.getBoolean("AnalyticsSW", true))
        FlurryAgent.onStartSession(ctx, Constants_API.Flurry_Key);
    //-----------------------------------
}