@Override public void onDestroy() { super.onDestroy(); if (isServiceConnected(RcsServiceName.CAPABILITY)) { // Remove image sharing listener try { getCapabilityApi().removeCapabilitiesListener(mCapabilitiesListener); } catch (RcsServiceException e) { Log.w(LOGTAG, ExceptionUtil.getFullStackTrace(e)); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set layout setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.contacts_vcard); // Set the contact selector mSpinner = (Spinner) findViewById(R.id.contact); mSpinner.setAdapter(ContactListAdapter.createContactListAdapter(this)); mSpinner.setOnItemSelectedListener(listenerContact); // Set button callback Button showBtn = (Button) findViewById(R.id.show_btn); showBtn.setOnClickListener(btnShowListener); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(); /* Set layout */ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.capabilities_request); /* Set the contact selector */ mSpinner = (Spinner) findViewById(R.id.contact); mSpinner.setAdapter(ContactListAdapter.createContactListAdapter(this)); mSpinner.setOnItemSelectedListener(mListenerContact); /* Set button callback */ Button refreshBtn = (Button) findViewById(R.id.refresh_btn); refreshBtn.setOnClickListener(mBtnRefreshListener); /* Update refresh button */ if (mSpinner.getAdapter().getCount() == 0) { // Disable button if no contact available refreshBtn.setEnabled(false); } else { refreshBtn.setEnabled(true); } /* Register to API connection manager */ if (!isServiceConnected(RcsServiceName.CAPABILITY)) { showMessageThenExit(R.string.label_service_not_available); return; } startMonitorServices(RcsServiceName.CAPABILITY); try { getCapabilityApi().addCapabilitiesListener(mCapabilitiesListener); } catch (RcsServiceException e) { showExceptionThenExit(e); } }