Search in sources :

Example 1 with HeadsetService

use of com.bel.android.dspmanager.service.HeadsetService in project android_packages_apps_DSPManager by CyanogenMod.

the class MyAdapter method onResume.

@Override
public void onResume() {
    super.onResume();
    ServiceConnection connection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName name, IBinder binder) {
            HeadsetService service = ((HeadsetService.LocalBinder) binder).getService();
            String routing = service.getAudioOutputRouting();
            String[] entries = pagerAdapter.getEntries();
            for (int i = 0; i < entries.length; i++) {
                if (routing.equals(entries[i])) {
                    viewPager.setCurrentItem(i);
                    break;
                }
            }
            unbindService(this);
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
        }
    };
    Intent serviceIntent = new Intent(this, HeadsetService.class);
    bindService(serviceIntent, connection, 0);
}
Also used : ServiceConnection(android.content.ServiceConnection) IBinder(android.os.IBinder) HeadsetService(com.bel.android.dspmanager.service.HeadsetService) ComponentName(android.content.ComponentName) Intent(android.content.Intent)

Aggregations

ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 ServiceConnection (android.content.ServiceConnection)1 IBinder (android.os.IBinder)1 HeadsetService (com.bel.android.dspmanager.service.HeadsetService)1