List of usage examples for android.content Context BIND_AUTO_CREATE
int BIND_AUTO_CREATE
To view the source code for android.content Context BIND_AUTO_CREATE.
Click Source Link
From source file:com.orange.datavenue.ValueFragment.java
@Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG_NAME, "onCreate()"); super.onCreate(savedInstanceState); setHasOptionsMenu(true);/*from w w w . java 2s . c o m*/ if (!mIsBound) { Intent service = new Intent(getActivity(), LocationService.class); getActivity().startService(service); getActivity().bindService(new Intent(getActivity(), LocationService.class), mConnection, Context.BIND_AUTO_CREATE); } }
From source file:de.tubs.ibr.dtn.daemon.api.SelectNeighborFragment.java
@Override public void onResume() { super.onResume(); // Establish a connection with the service. We use an explicit // class name because we want a specific service implementation that // we know will be running in our own process (and thus won't be // supporting component replacement by other applications). Intent bindIntent = DaemonService.createDtnServiceIntent(getActivity()); getActivity().bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE); }
From source file:com.mbientlab.metawear.tutorial.multimw.MainActivityFragment.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Activity owner = getActivity();// w w w . ja v a 2s. c o m owner.getApplicationContext().bindService(new Intent(owner, BtleService.class), this, Context.BIND_AUTO_CREATE); }
From source file:com.mylovemhz.muse.MainActivity.java
@Override protected void onStart() { super.onStart(); Intent intent = new Intent(this, MusicService.class); startService(intent);/* w ww . j a v a 2 s.co m*/ bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:biz.wiz.android.wallet.ui.BlockListFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); activity.bindService(new Intent(activity, BlockchainServiceImpl.class), serviceConnection, Context.BIND_AUTO_CREATE); }
From source file:com.anjlab.android.iab.v3.BillingProcessor.java
private void bindPlayServices() { try {//from w ww. j a v a2 s . co m Intent iapIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); iapIntent.setPackage("com.android.vending"); getContext().bindService(iapIntent, serviceConnection, Context.BIND_AUTO_CREATE); } catch (Exception e) { Log.e(LOG_TAG, e.toString()); } }
From source file:cm.aptoide.pt.ScheduledDownloads.java
@Override protected void onCreate(Bundle savedInstance) { AptoideThemePicker.setAptoideTheme(this); super.onCreate(savedInstance); setContentView(R.layout.list_sch_downloads); // getSupportActionBar().hide(); if (!isRunning) { isRunning = true;// w ww . j av a 2 s . c om if (!serviceManagerIsBound) { bindService(new Intent(this, ServiceManagerDownload.class), serviceManagerConnection, Context.BIND_AUTO_CREATE); } } }
From source file:cm.aptoide.ptdev.ScheduledDownloadsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Aptoide.getThemePicker().setAptoideTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.page_sch_downloads); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(true); getSupportActionBar().setTitle(getString(R.string.setting_schdwntitle)); lv = (ListView) findViewById(android.R.id.list); lv.setDivider(null);//from w ww . jav a 2 s .com db = new Database(Aptoide.getDb()); bindService(new Intent(this, DownloadService.class), conn, Context.BIND_AUTO_CREATE); adapter = new CursorAdapter(this, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER) { @Override public View newView(Context context, Cursor arg1, ViewGroup arg2) { return LayoutInflater.from(context).inflate(R.layout.row_sch_download, null); } @Override public void bindView(View convertView, Context arg1, Cursor c) { // Planet to display ScheduledDownload scheduledDownload = scheduledDownloadsHashMap .get(c.getLong(c.getColumnIndex("_id"))); // The child views in each row. CheckBox checkBoxScheduled; TextView textViewName; TextView textViewVersion; ImageView imageViewIcon; // Create a new row view if (convertView.getTag() == null) { // Find the child views. textViewName = (TextView) convertView.findViewById(R.id.name); textViewVersion = (TextView) convertView.findViewById(R.id.appversion); checkBoxScheduled = (CheckBox) convertView.findViewById(R.id.schDwnChkBox); imageViewIcon = (ImageView) convertView.findViewById(R.id.appicon); // Optimization: Tag the row with it's child views, so we don't have to // call findViewById() later when we reuse the row. convertView.setTag(new Holder(textViewName, textViewVersion, checkBoxScheduled, imageViewIcon)); // If CheckBox is toggled, update the planet it is tagged with. checkBoxScheduled.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { CheckBox cb = (CheckBox) v; ScheduledDownload schDownload = (ScheduledDownload) cb.getTag(); schDownload.setChecked(cb.isChecked()); } }); } // Reuse existing row view else { // Because we use a ViewHolder, we avoid having to call findViewById(). Holder viewHolder = (Holder) convertView.getTag(); checkBoxScheduled = viewHolder.checkBoxScheduled; textViewVersion = viewHolder.textViewVersion; textViewName = viewHolder.textViewName; imageViewIcon = viewHolder.imageViewIcon; } // Tag the CheckBox with the Planet it is displaying, so that we can // access the planet in onClick() when the CheckBox is toggled. checkBoxScheduled.setTag(scheduledDownload); // Display planet data checkBoxScheduled.setChecked(scheduledDownload.isChecked()); textViewName.setText(scheduledDownload.getName()); textViewVersion.setText(scheduledDownload.getVername()); ImageLoader.getInstance().displayImage(scheduledDownload.getIconPath(), imageViewIcon); } }; getSupportLoaderManager().initLoader(0, null, this); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View item, int arg2, long arg3) { ScheduledDownload scheduledDownload = (ScheduledDownload) ((Holder) item.getTag()).checkBoxScheduled .getTag(); scheduledDownload.toggleChecked(); Holder viewHolder = (Holder) item.getTag(); viewHolder.checkBoxScheduled.setChecked(scheduledDownload.isChecked()); } }); if (getIntent().hasExtra("downloadAll")) { ScheduledDownloadsDialog pd = new ScheduledDownloadsDialog(); pd.show(getSupportFragmentManager(), "installAllScheduled"); } lv.setAdapter(adapter); }
From source file:com.shenqu.jlplayer.nRFUARTv2.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.rfuart_main); mBtAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBtAdapter == null) { Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); finish();//from ww w . ja va2 s .c o m return; } messageListView = (ListView) findViewById(R.id.listMessage); listAdapter = new ArrayAdapter<String>(this, R.layout.message_detail); messageListView.setAdapter(listAdapter); messageListView.setDivider(null); edtMessage = (EditText) findViewById(R.id.sendText); btnConnectDisconnect = (Button) findViewById(R.id.btn_select); btnConnectDisconnect.setOnClickListener(this); btnSend = (Button) findViewById(R.id.sendButton); btnSend.setOnClickListener(this); /** * ? nRFUART service * */ Intent bindIntent = new Intent(this, UartService.class); bindService(bindIntent, mServiceConnection, Context.BIND_AUTO_CREATE); LocalBroadcastManager.getInstance(this).registerReceiver(UARTStatusChangeReceiver, makeGattUpdateIntentFilter()); }
From source file:com.ubuntuone.android.files.activity.GalleryActivity.java
private void doBindService() { bindService(new Intent(GalleryActivity.this, UpDownService.class), conn, Context.BIND_AUTO_CREATE); isBound = true;/* w ww . ja v a 2 s. co m*/ }