Example usage for android.os Message setData

List of usage examples for android.os Message setData

Introduction

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

Prototype

public void setData(Bundle data) 

Source Link

Document

Sets a Bundle of arbitrary data values.

Usage

From source file:com.cognizant.trumobi.PersonaLauncher.java

public void onSharedPreferenceChanged(SharedPreferences sp, String key) {
    // ADW: Try to add the restart flag here instead on preferences activity
    if (PersonaAlmostNexusSettingsHelper.needsRestart(key)) {
        // 290778 Commented for Higher SDK version
        // setPersistent(false);
        mShouldRestart = false;//from w ww.ja va 2 s  .  c  o  m
    } else {
        // TODO: ADW Move here all the updates instead on
        // updateAlmostNexusUI()
        if (key.equals("homeOrientation")) {
            if (!mMessWithPersistence) {
                changeOrientation(PersonaAlmostNexusSettingsHelper.getDesktopOrientation(this), false);
            } else {
                // ADW: If a user changes between different orientation
                // modes
                // we temporarily disable persistence to change the app
                // orientation
                // it will be re-enabled on the next onCreate
                // setPersistent(false);
                changeOrientation(PersonaAlmostNexusSettingsHelper.getDesktopOrientation(this), true);
            }
        } else if (key.equals("systemPersistent")) {
            mMessWithPersistence = PersonaAlmostNexusSettingsHelper.getSystemPersistent(this);
            if (mMessWithPersistence) {
                changeOrientation(PersonaAlmostNexusSettingsHelper.getDesktopOrientation(this), true);
                // ADW: If previously in portrait, set persistent
                // else, it will call the setPersistent on the next onCreate
                // caused by the orientation change
                if (savedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
                    // setPersistent(true);
                }

            } else {
                // setPersistent(false);
                changeOrientation(PersonaAlmostNexusSettingsHelper.getDesktopOrientation(this), false);
            }
        } else if (key.equals("notif_receiver")) {
            boolean useNotifReceiver = PersonaAlmostNexusSettingsHelper.getNotifReceiver(this);
            if (!useNotifReceiver) {
                if (mCounterReceiver != null)
                    unregisterReceiver(mCounterReceiver);
                mCounterReceiver = null;
            } else {
                if (mCounterReceiver == null) {
                    mCounterReceiver = new PersonaCounterReceiver(this);
                    mCounterReceiver.setCounterListener(new PersonaCounterReceiver.OnCounterChangedListener() {
                        public void onTrigger(String pname, int counter, int color) {
                            PersonaLog.d("personalauncher",
                                    "updateCountersForPackage called from onSharedPreferenceChanged");
                            //                              updateCountersForPackage(pname,
                            //                                    counter, color, 0);

                            Bundle b = new Bundle();

                            b.putString("package", "com.cognizant.trumobi");
                            b.putInt("counter", counter);
                            b.putInt("color", R.color.PR_TEXTBOX_FOCUSED_COLOR);
                            b.putInt("updateCountFor", 0);
                            Message m = new Message();
                            m.setData(b);
                            UiHandler.sendMessage(m);
                        }
                    });
                }
                registerReceiver(mCounterReceiver, mCounterReceiver.getFilter());
            }
        } else if (key.equals("main_dock_style")) {
            int dockstyle = PersonaAlmostNexusSettingsHelper.getmainDockStyle(this);
            if (dockstyle == DOCK_STYLE_NONE) {
                // mShouldRestart=true;
            } else if (mDockStyle == DOCK_STYLE_NONE) {
                // mShouldRestart=true;
            }
        } else if (key.equals("deletezone_style")) {
            int dz = PersonaAlmostNexusSettingsHelper.getDeletezoneStyle(this);
            if (mDeleteZone != null)
                mDeleteZone.setPosition(dz);
        }
        updateAlmostNexusUI();
    }
}

From source file:net.networksaremadeofstring.cyllell.ViewCookbooks_Fragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    settings = this.getActivity().getSharedPreferences("Cyllell", 0);
    try {/*from  ww  w  . ja va 2  s  .  c  o  m*/
        Cut = new Cuts(getActivity());
    } catch (Exception e) {
        e.printStackTrace();
    }

    dialog = new ProgressDialog(getActivity());
    dialog.setTitle("Contacting Chef");

    dialog.setMessage("Please wait: Prepping Authentication protocols");
    dialog.setIndeterminate(true);
    if (listOfCookbooks.size() < 1) {
        dialog.show();
    }

    updateListNotify = new Handler() {
        public void handleMessage(Message msg) {
            int tag = msg.getData().getInt("tag", 999999);

            if (msg.what == 0) {
                if (tag != 999999) {
                    listOfCookbooks.get(tag).SetSpinnerVisible();
                }
            } else if (msg.what == 1) {
                //Get rid of the lock
                CutInProgress = false;

                //the notifyDataSetChanged() will handle the rest
            } else if (msg.what == 99) {
                if (tag != 999999) {
                    Toast.makeText(ViewCookbooks_Fragment.this.getActivity(),
                            "An error occured during that operation.", Toast.LENGTH_LONG).show();
                    listOfCookbooks.get(tag).SetErrorState();
                }
            }
            CookbookAdapter.notifyDataSetChanged();
        }
    };

    handler = new Handler() {
        public void handleMessage(Message msg) {
            //Once we've checked the data is good to use start processing it
            if (msg.what == 0) {
                OnClickListener listener = new OnClickListener() {
                    public void onClick(View v) {
                        GetMoreDetails((Integer) v.getTag());
                    }
                };

                OnLongClickListener listenerLong = new OnLongClickListener() {
                    public boolean onLongClick(View v) {
                        //selectForCAB((Integer)v.getTag());
                        Toast.makeText(getActivity(), "This version doesn't support Cookbook editing yet",
                                Toast.LENGTH_SHORT).show();
                        return true;
                    }
                };

                CookbookAdapter = new CookbookListAdaptor(getActivity(), listOfCookbooks, listener,
                        listenerLong);
                try {
                    list = (ListView) getView().findViewById(R.id.cookbooksListView);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                if (list != null) {
                    if (CookbookAdapter != null) {
                        list.setAdapter(CookbookAdapter);
                    } else {
                        //Log.e("CookbookAdapter","CookbookAdapter is null");
                    }
                } else {
                    //Log.e("List","List is null");
                }

                dialog.dismiss();
            } else if (msg.what == 200) {
                dialog.setMessage("Sending request to Chef...");
            } else if (msg.what == 201) {
                dialog.setMessage("Parsing JSON.....");
            } else if (msg.what == 202) {
                dialog.setMessage("Populating UI!");
            } else {
                //Close the Progress dialog
                dialog.dismiss();

                //Alert the user that something went terribly wrong
                AlertDialog alertDialog = new AlertDialog.Builder(context).create();
                alertDialog.setTitle("API Error");
                alertDialog.setMessage("There was an error communicating with the API:\n"
                        + msg.getData().getString("exception"));
                alertDialog.setButton2("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        //getActivity().finish();
                    }
                });
                alertDialog.setIcon(R.drawable.icon);
                alertDialog.show();
            }
        }
    };

    Thread dataPreload = new Thread() {
        public void run() {
            if (listOfCookbooks.size() > 0) {
                handler.sendEmptyMessage(0);
            } else {
                try {
                    handler.sendEmptyMessage(200);
                    Cookbooks = Cut.GetCookbooks();
                    handler.sendEmptyMessage(201);
                    JSONArray Keys = Cookbooks.names();
                    String URI = "";
                    String Version = "0.0.0";
                    JSONObject cookbook;
                    for (int i = 0; i < Cookbooks.length(); i++) {
                        cookbook = new JSONObject(Cookbooks.getString(Keys.get(i).toString()));
                        //URI = Cookbooks.getString(Keys.get(i).toString()).replaceFirst("^(https://|http://).*/cookbooks/", "");
                        //Version = Cookbooks.getString(Keys.get(i).toString())
                        //Log.i("Cookbook Name", Keys.get(i).toString());
                        URI = cookbook.getString("url").replaceFirst("^(https://|http://).*/cookbooks/", "");
                        //Log.i("Cookbook URL", URI);

                        JSONArray versions = cookbook.getJSONArray("versions");

                        Version = versions.getJSONObject(versions.length() - 1).getString("version");
                        //Log.i("Cookbook version", Version);

                        listOfCookbooks.add(new Cookbook(Keys.get(i).toString(), URI, Version));
                    }

                    handler.sendEmptyMessage(202);
                    handler.sendEmptyMessage(0);
                } catch (Exception e) {
                    BugSenseHandler.log("ViewCookbooksFragment", e);
                    e.printStackTrace();
                    Message msg = new Message();
                    Bundle data = new Bundle();
                    data.putString("exception", e.getMessage());
                    msg.setData(data);
                    msg.what = 1;
                    handler.sendMessage(msg);
                }
            }
            return;
        }
    };

    dataPreload.start();
    return inflater.inflate(R.layout.cookbooks_landing, container, false);
}

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

/** Called when the activity is first created. */
@Override/*from  w  ww.j a va  2s . c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    settings = PreferenceManager.getDefaultSharedPreferences(this);

    setContentView(R.layout.view_zenoss_device3);

    actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setHomeButtonEnabled(true);

    list = (ListView) findViewById(R.id.ZenossEventsList);

    errorHandler = new Handler() {
        public void handleMessage(Message msg) {
            try {
                Toast.makeText(ViewZenossDevice.this, msg.getData().getString("exception"), Toast.LENGTH_LONG)
                        .show();
            } catch (Exception e) {
                ////BugSenseHandler.sendException("ViewZenossDevice-ErrorHandler", e);
            }
        }
    };

    loadAverageHandler = new Handler() {
        public void handleMessage(Message msg) {
            try {
                ((ImageView) findViewById(R.id.loadAverageGraph)).setImageDrawable(loadAverageGraph);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    CPUGraphHandler = new Handler() {
        public void handleMessage(Message msg) {
            try {
                ((ImageView) findViewById(R.id.CPUGraph)).setImageDrawable(CPUGraph);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    MemoryGraphHandler = new Handler() {
        public void handleMessage(Message msg) {
            try {
                ((ImageView) findViewById(R.id.MemoryGraph)).setImageDrawable(MemoryGraph);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    eventsHandler = new Handler() {
        public void handleMessage(Message msg) {
            try {
                //((ProgressBar) findViewById(R.id.eventsProgressBar)).setVisibility(4);
            } catch (Exception e) {
                ////BugSenseHandler.sendException("ViewZenossDevice", e);
            }

            if (EventCount > 0 && msg.what == 1) {
                try {
                    adapter = new ZenossEventsAdaptor(ViewZenossDevice.this, listOfZenossEvents, false);
                    list.setAdapter(adapter);
                } catch (Exception e) {
                    ////BugSenseHandler.sendException("ViewZenossDevice", e);
                }
            } else {
                list = null;
            }
        }
    };

    firstLoadHandler = new Handler() {
        public void handleMessage(Message msg) {
            if (dialog != null)
                dialog.dismiss();

            try {
                if (DeviceObject != null && msg.what == 1
                        && DeviceObject.getJSONObject("result").getBoolean("success") == true) {
                    //Log.i("DeviceDetails",DeviceObject.toString());
                    DeviceDetails = DeviceObject.getJSONObject("result").getJSONObject("data");

                    try {
                        String Name = DeviceDetails.getString("snmpSysName").toUpperCase();
                        if (Name.equals("")) {
                            Name = DeviceDetails.getString("name").toUpperCase();
                        }

                        ((TextView) findViewById(R.id.deviceID)).setText(Name);
                        //actionbar.setTitle(DeviceDetails.getString("snmpSysName"));
                        actionbar.setSubtitle(Name);
                    } catch (Exception e) {
                        ((TextView) findViewById(R.id.deviceID)).setText("--");
                    }

                    try {
                        ((TextView) findViewById(R.id.modelTime))
                                .setText(DeviceDetails.getString("lastCollected"));
                    } catch (Exception e) {
                        ((TextView) findViewById(R.id.modelTime)).setText("Unknown");
                    }

                    try {
                        ((TextView) findViewById(R.id.firstSeen)).setText(DeviceDetails.getString("firstSeen"));
                    } catch (Exception e) {
                        ((TextView) findViewById(R.id.firstSeen)).setText("");
                    }

                    try {
                        ((TextView) findViewById(R.id.location))
                                .setText(DeviceDetails.getString("snmpLocation"));
                    } catch (Exception e) {
                        ((TextView) findViewById(R.id.location)).setText("Unknown Location");
                    }

                    try {
                        ((TextView) findViewById(R.id.uptime)).setText(DeviceDetails.getString("uptime"));
                    } catch (Exception e) {
                        //Already got a placeholder
                    }

                    try {
                        ((TextView) findViewById(R.id.productionState))
                                .setText(DeviceDetails.getString("productionState"));
                    } catch (Exception e) {
                        //Already got a placeholder
                    }

                    try {
                        ((TextView) findViewById(R.id.memorySwap))
                                .setText(DeviceDetails.getJSONObject("memory").getString("ram") + " / "
                                        + DeviceDetails.getJSONObject("memory").getString("swap"));
                    } catch (Exception e) {
                        //Already got a placeholder
                    }

                    String Groups = "";
                    try {
                        for (int i = 0; i < DeviceDetails.getJSONArray("groups").length(); i++) {
                            if (i > 0)
                                Groups += ", ";
                            try {
                                Groups += DeviceDetails.getJSONArray("groups").getJSONObject(i)
                                        .getString("name");
                            } catch (Exception e) {
                                ////BugSenseHandler.sendException("ViewZenossDevice", e);
                            }
                        }

                        ((TextView) findViewById(R.id.groups)).setText(Groups);

                    } catch (Exception e) {
                        ////BugSenseHandler.sendException("ViewZenossDevice", e);
                    }

                    String Systems = "";
                    try {
                        for (int i = 0; i < DeviceDetails.getJSONArray("systems").length(); i++) {
                            if (i > 0)
                                Systems += ", ";

                            Systems += DeviceDetails.getJSONArray("systems").getJSONObject(i).getString("name");
                        }

                        ((TextView) findViewById(R.id.systems)).setText(Systems);

                    } catch (Exception e) {
                        //Already got a placeholder
                        ////BugSenseHandler.sendException("ViewZenossDevice", e);
                    }

                    //etc
                } else {
                    Toast.makeText(ViewZenossDevice.this, "There was an error loading the Device details",
                            Toast.LENGTH_LONG).show();
                    //finish();
                }
            } catch (Exception e) {
                //e.printStackTrace();
                Toast.makeText(ViewZenossDevice.this, "An error was encountered parsing the JSON.",
                        Toast.LENGTH_LONG).show();
                ////BugSenseHandler.sendException("ViewZenossDevice", e);
            }
        }
    };

    dialog = new ProgressDialog(this);
    dialog.setTitle("Contacting Zenoss");
    dialog.setMessage("Please wait:\nLoading Device details....");
    dialog.show();
    dataPreload = new Thread() {
        public void run() {
            try {
                Message msg = new Message();
                Bundle bundle = new Bundle();

                if (API == null) {
                    try {
                        /*if(settings.getBoolean("httpBasicAuth", false))
                        {
                           API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", ""));
                        }
                        else
                        {
                           API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""));
                        }*/
                    }
                    /*catch(ConnectTimeoutException cte)
                    {
                       if(cte.getMessage() != null)
                       {
                          //Toast.makeText(ViewZenossDevice.this, "An error was encountered;\r\n" + cte.getMessage().toString(), Toast.LENGTH_LONG).show();
                          bundle.putString("exception","The connection timed out;\r\n" + cte.getMessage().toString());
                          msg.setData(bundle);
                          msg.what = 0;
                          errorHandler.sendMessage(msg);
                       }
                       else
                       {
                          bundle.putString("exception","A time out error was encountered but the exception thrown contains no further information.");
                          msg.setData(bundle);
                          msg.what = 0;
                          errorHandler.sendMessage(msg);
                          //Toast.makeText(ViewZenossDevice.this, "An 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;
                            errorHandler.sendMessage(msg);
                            //Toast.makeText(ViewZenossDevice.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;
                            errorHandler.sendMessage(msg);
                            //Toast.makeText(ViewZenossDevice.this, "An error was encountered but the exception thrown contains no further information.", Toast.LENGTH_LONG).show();
                        }
                    }

                    DeviceObject = API.GetDevice(getIntent().getStringExtra("UID"));
                }
            } catch (Exception e) {
                //e.printStackTrace();
                //BugSenseHandler.sendException("updateDevices-dataPreload",e);
                firstLoadHandler.sendEmptyMessage(0);
            }

            firstLoadHandler.sendEmptyMessage(1);
        }
    };

    dataPreload.start();

    loadAvgGraphLoad = new Thread() {
        public void run() {
            try {
                if (API == null) {
                    Message msg = new Message();
                    Bundle bundle = new Bundle();

                    try {
                        /*if(settings.getBoolean("httpBasicAuth", false))
                        {
                           API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", ""));
                        }
                        else
                        {
                           API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""));
                        }*/
                        if (PreferenceManager.getDefaultSharedPreferences(ViewZenossDevice.this)
                                .getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) {
                            API = new ZenossAPIZaas();
                        } else {
                            API = new ZenossAPICore();
                        }

                        ZenossCredentials credentials = new ZenossCredentials(ViewZenossDevice.this);
                        API.Login(credentials);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                JSONObject graphURLs = API.GetDeviceGraphs(getIntent().getStringExtra("UID"));

                //Log.e("graphURLs",graphURLs.toString(3));
                int urlCount = graphURLs.getJSONObject("result").getJSONArray("data").length();

                for (int i = 0; i < urlCount; i++) {
                    JSONObject currentGraph = null;
                    try {
                        currentGraph = graphURLs.getJSONObject("result").getJSONArray("data").getJSONObject(i);

                        if (currentGraph.getString("title").equals("Load Average")) {
                            loadAverageGraph = API.GetGraph(currentGraph.getString("url"));
                            loadAverageHandler.sendEmptyMessage(1);
                        } else if (currentGraph.getString("title").equals("CPU Utilization")) {
                            CPUGraph = API.GetGraph(currentGraph.getString("url"));
                            CPUGraphHandler.sendEmptyMessage(1);
                        } else if (currentGraph.getString("title").equals("Memory Utilization")) {
                            MemoryGraph = API.GetGraph(currentGraph.getString("url"));
                            MemoryGraphHandler.sendEmptyMessage(1);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

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

    eventsLoad = new Thread() {
        public void run() {
            try {
                if (API == null) {
                    Message msg = new Message();
                    Bundle bundle = new Bundle();

                    try {
                        /*if(settings.getBoolean("httpBasicAuth", false))
                        {
                           API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", ""));
                        }
                        else
                        {
                           API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""));
                        }*/
                        if (PreferenceManager.getDefaultSharedPreferences(ViewZenossDevice.this)
                                .getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) {
                            API = new ZenossAPIZaas();
                        } else {
                            API = new ZenossAPICore();
                        }

                        ZenossCredentials credentials = new ZenossCredentials(ViewZenossDevice.this);
                        API.Login(credentials);
                    } catch (ConnectTimeoutException cte) {
                        if (cte.getMessage() != null) {
                            //Toast.makeText(ViewZenossDevice.this, , Toast.LENGTH_LONG).show();
                            bundle.putString("exception",
                                    "An error was encountered;\r\n" + cte.getMessage().toString());
                        } else {
                            //Toast.makeText(ViewZenossDevice.this, "An error was encountered but the exception thrown contains no further information.", Toast.LENGTH_LONG).show();
                            bundle.putString("exception",
                                    "An error was encountered but the exception thrown contains no further information.");
                        }
                        msg.setData(bundle);
                        msg.what = 0;
                        errorHandler.sendMessage(msg);
                    } catch (Exception e) {
                        if (e.getMessage() != null) {
                            //Toast.makeText(ViewZenossDevice.this, "An error was encountered;\r\n" + e.getMessage().toString(), Toast.LENGTH_LONG).show();
                            bundle.putString("exception",
                                    "An error was encountered;\r\n" + e.getMessage().toString());
                        } else {
                            //Toast.makeText(ViewZenossDevice.this, "An error was encountered but the exception thrown contains no further information.", Toast.LENGTH_LONG).show();
                            bundle.putString("exception",
                                    "An error was encountered but the exception thrown contains no further information.");
                        }

                        msg.setData(bundle);
                        msg.what = 0;
                        errorHandler.sendMessage(msg);
                    }
                }

                /*try
                {   
                   EventsObject = API.GetDeviceEvents(getIntent().getStringExtra("UID"),false);
                }
                catch(Exception e)
                {
                   e.printStackTrace();
                }*/

                /*try
                {
                   if((EventsObject.has("type") && EventsObject.get("type").equals("exception")) || !EventsObject.getJSONObject("result").has("totalCount") )
                   {
                      EventsObject = API.GetDeviceEvents(getIntent().getStringExtra("UID"),true);
                   }
                }
                catch(Exception e)
                {
                   e.printStackTrace();
                }*/

                if (null != EventsObject && EventsObject.has("result")
                        && EventsObject.getJSONObject("result").getInt("totalCount") > 0) {
                    Events = EventsObject.getJSONObject("result").getJSONArray("events");

                    try {
                        if (EventsObject != null) {
                            EventCount = EventsObject.getJSONObject("result").getInt("totalCount");

                            for (int i = 0; i < EventCount; i++) {
                                //JSONObject CurrentEvent = null;
                                try {
                                    //CurrentEvent = Events.getJSONObject(i);
                                    listOfZenossEvents.add(new ZenossEvent(Events.getJSONObject(i)));
                                    //Log.i("ForLoop",CurrentEvent.getString("summary"));
                                } catch (JSONException e) {
                                    //Log.e("API - Stage 2 - Inner", e.getMessage());
                                } catch (Exception e) {
                                    //BugSenseHandler.sendException("ViewZenossDevice-EventsLoop", e);
                                }
                            }

                            eventsHandler.sendEmptyMessage(1);
                        } else {
                            //Log.i("eventsLoad","Had a problem; EventsObject was null");
                            //eventsHandler.sendEmptyMessage(0);
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        //BugSenseHandler.sendException("ViewZenossDevice-Events", e);
                        eventsHandler.sendEmptyMessage(0);
                    }
                } else {
                    eventsHandler.sendEmptyMessage(0);
                }
            } catch (Exception e) {
                //Log.e("API - Stage 1", e.getMessage());
                //BugSenseHandler.sendException("ViewZenossDevice-Events", e);
                eventsHandler.sendEmptyMessage(0);
            }
        }
    };
    eventsLoad.start();
}

From source file:com.zoffcc.applications.zanavi.Navit.java

public static void msg_to_msg_handler(Bundle b, int id) {
    Message msg = Navit_progress_h.obtainMessage();
    msg.what = id;//from  www . ja v  a  2 s  . c o m
    msg.setData(b);
    Navit_progress_h.sendMessage(msg);
}

From source file:com.zoffcc.applications.zanavi.Navit.java

public static void recalculate_route() {
    try {//w w w  . j  a  v  a2 s .  co  m
        // update route, if a route is set
        Message msg = new Message();
        Bundle b = new Bundle();
        b.putInt("Callback", 73);
        msg.setData(b);
        NavitGraphics.callback_handler.sendMessage(msg);
    } catch (Exception e) {
    }
}

From source file:com.zoffcc.applications.zanavi.Navit.java

static void draw_map() {
    try {/*from   w ww.  j av a  2 s  .c  om*/
        // draw map no-async
        Message msg = new Message();
        Bundle b = new Bundle();
        b.putInt("Callback", 64);
        msg.setData(b);
        NavitGraphics.callback_handler.sendMessage(msg);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.zoffcc.applications.zanavi.Navit.java

public static void zoom_to_route() {
    try {//  ww w. j  a va2s . com
        //System.out.println("");
        //System.out.println("*** Zoom to ROUTE ***");
        //System.out.println("");
        Message msg = new Message();
        Bundle b = new Bundle();
        b.putInt("Callback", 17);
        msg.setData(b);
        NavitGraphics.callback_handler.sendMessage(msg);

        set_map_position_to_screen_center();
    } catch (Exception e) {
    }
}

From source file:com.zoffcc.applications.zanavi.Navit.java

public static void show_mem_used() // wrapper
{
    try {//from  ww  w  . j  a  v  a  2  s .c  o  m
        Message msg = Navit_progress_h.obtainMessage();
        Bundle b = new Bundle();
        msg.what = 14;
        msg.setData(b);
        Navit_progress_h.sendMessage(msg);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.zoffcc.applications.zanavi.Navit.java

public static void follow_button_off() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Navit.getBaseContext_);
    SharedPreferences.Editor editor = prefs.edit();
    Navit.follow_current = Navit.follow_off;
    p.PREF_follow_gps = false;/*from  w  w  w .  j  a  va  2s.  c  om*/
    editor.putBoolean("follow_gps", p.PREF_follow_gps);
    editor.commit();
    getPrefs();
    activatePrefs(1);

    // follow mode OFF -----------
    Message msg = new Message();
    Bundle b = new Bundle();
    b.putInt("Callback", 75);
    msg.setData(b);
    try {
        NavitGraphics.callback_handler.sendMessage(msg);
    } catch (Exception e) {
    }
    // follow mode OFF -----------

    msg = Navit_progress_h.obtainMessage();
    b = new Bundle();
    msg.what = 32;
    try {
        Navit_progress_h.sendMessage(msg);
    } catch (Exception e) {
    }

    // JB fix
    //NavitGraphics.NavitAOSDJava_.postInvalidate();
    //System.out.println("xx paint 13 xx");
    NavitGraphics.OSD_new.postInvalidate();
    NavitGraphics.NavitAOverlay_s.postInvalidate();

}

From source file:com.zoffcc.applications.zanavi.Navit.java

static void dim_screen_wrapper() {
    try {/* w  w  w  .  ja  v  a 2  s .co m*/
        Message msg = Navit.Navit_progress_h.obtainMessage();
        Bundle b = new Bundle();
        msg.what = 20;
        msg.setData(b);
        Navit.Navit_progress_h.sendMessage(msg);
    } catch (Exception e) {
        e.printStackTrace();
    }
}