List of usage examples for android.os Message Message
public Message()
From source file:com.nbplus.vbroadlauncher.service.GetRadioChannelTask.java
@Override protected void onPostExecute(BaseApiResult result) { // TODO : sample data // ArrayList<RadioChannelInfo.RadioChannel> items = new ArrayList<>(); // RadioChannelInfo.RadioChannel item = new RadioChannelInfo.RadioChannel(); // item.channelName = "KBS 1FM(??FM)"; // item.channelUrl = "rtsp://kbs-radio.gscdn.com/tunein_1fm/_definst_/tunein_1fm.stream"; // items.add(item); ///*from w w w . j a v a 2 s . co m*/ // ((RadioChannelInfo)result).setResultCode("0000"); // ((RadioChannelInfo)result).setRadioChannelList(items); // end of TODO : sample data // TODO ;; remove later.... if (mHandler != null) { Message message = new Message(); message.what = Constants.HANDLER_MESSAGE_GET_RADIO_CHANNEL_TASK; message.obj = result; mHandler.sendMessage(message); } }
From source file:com.autoparts.buyers.action_content.fragment.ModelFragment.java
public void setViewData() { expandListView.setAdapter(adapter);//from w ww.ja v a 2 s .c o m int groupCount = expandListView.getCount(); for (int i = 0; i < groupCount; i++) { expandListView.expandGroup(i); } expandListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { return true; } }); expandListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView expandableListView, View view, final int i, int i1, long l) { Message message = new Message(); message.what = 0; message.obj = mLists.get(i); message.arg1 = i1; if (handler != null) { handler.sendMessage(message); } return false; } }); }
From source file:cn.sharesdk.analysis.server.ServiceHelper.java
public synchronized void sendIsAppExitMsg() { Message msg = new Message(); msg.what = EXIT_APP; handler.sendMessageDelayed(msg, 1000); }
From source file:com.hybris.mobile.activity.BarCodeScannerActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { String contents = data.getStringExtra(SCAN_RESULT); String format = data.getStringExtra(SCAN_RESULT_FORMAT); Log.i(TAG, "Contents: " + contents); Log.i(TAG, "format: " + format); String isUseSpecificBaseUrl = Hybris .getSharedPreferenceString(InternalConstants.KEY_PREF_TOGGLE_SPECIFIC_BASE_URL); if (StringUtils.equals(isUseSpecificBaseUrl, String.valueOf(false))) { Log.i(TAG, "calling default handler for url: " + contents); // We run the task to check the format and data availability of the barcode scanned new CheckBarcodeFormatAndValueTask().execute(contents, format); } else {// ww w .ja v a 2 s. co m //isScannerRunning = false; // WebView myWebView = new WebView(this); // myWebView = (WebView) findViewById(R.layout.app_web_view); Log.i(TAG, "calling webview activity with url: " + contents); // myWebView.loadUrl(contents); // WebSettings webSettings = myWebView.getSettings(); // webSettings.setJavaScriptEnabled(true); Intent localintent = new Intent(Hybris.getAppContext(), ScanCodeWebViewActivity.class); localintent.putExtra(Constants.DATA, contents); localintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Log.i(TAG, "Sending intent to start webview for url"); Hybris.getAppContext().startActivity(localintent); } } else if (resultCode == RESULT_CANCELED) { Message msg = new Message(); msg.what = BarCodeScannerActivity.MSG_CANCEL_SCAN; mHandler.sendMessage(msg); } }
From source file:com.example.main.BandWViewPagerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final GlobalID globalID = ((GlobalID) getApplication()); overridePendingTransition(R.anim.item_in, R.anim.list_out); setContentView(R.layout.activity_view_pager); mViewPager = (HackyViewPager) findViewById(R.id.view_pager); setContentView(mViewPager);/*www . j a v a 2s . c om*/ work = false; if (null != savedInstanceState) { final String decode = savedInstanceState.getString("ALL_List"); index = savedInstanceState.getInt("index"); if (log) Log.e(TAG, "null != savedInstanceState ALL_List = " + decode); globalID.start(context); if (globalID.BandWArrays.isEmpty()) { globalID.PD(context, "", "..."); Thread decode_thread = new Thread() { public void run() { getmArrays(decode); Message msg = new Message(); globalID.BandWArrays = ALL_List; mhandler.sendMessage(msg); } }; decode_thread.start(); } } else { Intent intent = getIntent(); Bundle data = intent.getExtras(); index = data.getInt("i"); ALL_List = globalID.BandWArrays; work = true; } samplePagerAdapter = new SamplePagerAdapter(BandWViewPagerActivity.this, IMG_List); mViewPager.setAdapter(samplePagerAdapter); samplePagerAdapter.notifyDataSetChanged(); Thread check = new Thread() { public void run() { while (!work) { try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); continue; } } for (int i = 0; i < ALL_List.size(); i++) { BandWEntity entity = ALL_List.get(i); if (!entity.getList_type()) { Message msg = new Message(); msg.what = i; msg.obj = entity; add_img_handler.sendMessage(msg); } } } }; check.start(); }
From source file:com.softminds.matrixcalculator.OperationFragments.FunctionalFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == 1452) { if (((GlobalValues) getActivity().getApplication()).DonationKeyFound()) { try { final Function function = ((GlobalValues) getActivity().getApplication()).getFunction(); Runnable runnable = new Runnable() { @Override// www. j av a2 s . co m public void run() { MatrixV2 m = function.ComputeFunction(SquareList.get(ClickPos)); Message message = new Message(); message.setData(m.getDataBundled()); myHandler.sendMessage(message); } }; Thread thread = new Thread(runnable); thread.start(); } catch (NullPointerException e) { Log.d("Exception : ", "Function at Global Context is Null"); e.printStackTrace(); } } else { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setCancelable(true); builder.setPositiveButton(R.string.Upgrade, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { final String ProPackage = "com.softminds.matrixcalculator.pro.key"; try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + ProPackage)); startActivity(intent); Toast.makeText(getContext(), R.string.OpeningPlay, Toast.LENGTH_SHORT).show(); } catch (ActivityNotFoundException e) { //if Play store is not installed startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + ProPackage))); } dialogInterface.dismiss(); } }); builder.setNegativeButton(R.string.Nope, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); builder.setTitle(getString(R.string.Upgrade)); builder.setMessage(R.string.UpgradeMess); builder.show(); } } }
From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.cellscanner.CellScanner.java
public void start(final ActiveOrPassiveStumbling stumblingMode) { if (!mSimpleCellScanner.isSupportedOnThisDevice()) { return;/*from w w w . jav a 2 s.c o m*/ } if (mCellScanTimer != null) { return; } LocalBroadcastManager.getInstance(mAppContext).registerReceiver(mReportFlushedReceiver, new IntentFilter(Reporter.ACTION_NEW_BUNDLE)); // This is to ensure the broadcast happens from the same thread the CellScanner start() is on mBroadcastScannedHandler = new Handler() { @Override public void handleMessage(Message msg) { Intent intent = (Intent) msg.obj; LocalBroadcastManager.getInstance(mAppContext).sendBroadcastSync(intent); } }; mSimpleCellScanner.start(); mCellScanTimer = new Timer(); mCellScanTimer.schedule(new TimerTask() { int mPassiveScanCount; @Override public void run() { if (!mSimpleCellScanner.isStarted()) { return; } if (stumblingMode == ActiveOrPassiveStumbling.PASSIVE_STUMBLING && mPassiveScanCount++ > AppGlobals.PASSIVE_MODE_MAX_SCANS_PER_GPS) { mPassiveScanCount = 0; stop(); return; } final long curTime = System.currentTimeMillis(); ArrayList<CellInfo> cells = new ArrayList<CellInfo>(mSimpleCellScanner.getCellInfo()); if (mReportWasFlushed.getAndSet(false)) { clearCells(); } if (cells.isEmpty()) { return; } for (CellInfo cell : cells) { addToCells(cell.getCellIdentity()); } Intent intent = new Intent(ACTION_CELLS_SCANNED); intent.putParcelableArrayListExtra(ACTION_CELLS_SCANNED_ARG_CELLS, cells); intent.putExtra(ACTION_CELLS_SCANNED_ARG_TIME, curTime); // send to handler, so broadcast is not from timer thread Message message = new Message(); message.obj = intent; mBroadcastScannedHandler.sendMessage(message); } }, 0, CELL_MIN_UPDATE_TIME); }
From source file:com.softminds.matrixcalculator.OperationFragments.RankFragment.java
private void FindRank(final int pos) { Runnable runnable = new Runnable() { @Override// ww w . ja v a2 s . c o m public void run() { MatrixV2 mat = ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(pos); double rank = mat.getRank(); Message message = new Message(); Bundle bundle = new Bundle(); bundle.putDouble("CALCULATED_RANK", rank); message.setData(bundle); handler.sendMessage(message); } }; Thread thread = new Thread(runnable); thread.start(); }
From source file:org.cocos2dx.lib.Cocos2dxActivity.java
@Override public void showDialog(final String pTitle, final String pMessage) { Message msg = new Message(); msg.what = Cocos2dxHandler.HANDLER_SHOW_DIALOG; msg.obj = new Cocos2dxHandler.DialogMessage(pTitle, pMessage); this.mHandler.sendMessage(msg); }
From source file:ibp.plugin.nsd.NSDPlugin.java
private void sendByHandler(String type, String data) { if (null != mHandler) { Bundle messageBundle = new Bundle(); messageBundle.putString("type", type); messageBundle.putString("msg", data); Message message = new Message(); message.setData(messageBundle);/*from ww w.j a v a 2 s . co m*/ mHandler.sendMessage(message); } }