Example usage for android.os RemoteException printStackTrace

List of usage examples for android.os RemoteException printStackTrace

Introduction

In this page you can find the example usage for android.os RemoteException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.morlunk.mumbleclient.channel.ChannelListAdapter.java

@Override
public long getItemId(int position) {
    try {//from w w w  . j a va 2 s  . c o m
        return mNodes.get(position).getId();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    return -1;
}

From source file:edu.nd.darts.cimon.CimonListView.java

/**
 * Register a new periodic update when metric is enabled through administration activity.
 * This method is called by the onCheckedChanged listener for the Enable button
 * of the administration rows when the state is changed to enable.
 * // w  w  w .j a  va  2s .co  m
 * @param metric    integer representing metric (per {@link Metrics}) to register
 * @param period    period between updates, in milliseconds
 * @param duration    duration to run monitor, in milliseconds
 * @param metadata    include metadata at top of csv report file
 * @param email    send csv report file to email
 * @param dropbox    send csv report file to Dropbox account folder
 * @param box    send csv report file to Box account folder
 * @param drive    send csv report file to Google Drive account folder
 */
public void registerPeriodic(int metric, long period, long duration, boolean metadata, boolean email,
        boolean dropbox, boolean box, boolean drive) {
    if (DebugLog.DEBUG)
        Log.d(TAG, "CimonListView.registerPeriodic - metric:" + metric + " period:" + period + " duration:"
                + duration);
    if (mCimonInterface == null) {
        if (DebugLog.INFO)
            Log.i(TAG, "CimonListView.OnClickListener - register: service inactive");
    } else {
        try {
            if (!adminObserver.getStatus(metric)) {
                int monitorId = mCimonInterface.registerPeriodic(metric, period, duration, false, null); //mMessenger
                adminObserver.setActive(metric, monitorId);
                monitorReports.append(monitorId, new MonitorReport(this, metric, monitorId, backgroundHandler,
                        adminObserver, metadata, email, dropbox, box, drive));
            }
        } catch (RemoteException e) {
            if (DebugLog.INFO)
                Log.i(TAG, "CimonListView.OnClickListener - register failed");
            e.printStackTrace();
        }
    }
}

From source file:com.morlunk.mumbleclient.channel.ChannelListAdapter.java

public int getUserPosition(int session) {
    long itemId = session | USER_ID_MASK;
    for (int i = 0; i < mNodes.size(); i++) {
        Node node = mNodes.get(i);
        try {// www. j a v  a2 s  .c  o m
            if (node.getId() == itemId) {
                return i;
            }
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    return -1;
}

From source file:com.morlunk.mumbleclient.channel.ChannelListAdapter.java

public int getChannelPosition(int channelId) {
    long itemId = channelId | CHANNEL_ID_MASK;
    for (int i = 0; i < mNodes.size(); i++) {
        Node node = mNodes.get(i);
        try {//from  www.ja  va  2 s  . co m
            if (node.getId() == itemId) {
                return i;
            }
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    return -1;
}

From source file:com.beem.project.beem.ui.ContactList.java

/**
 * Exectute a context menu action on a specified contact.
 * @param itemId the id of the menu action
 * @param contact the contact//from   w  w w  .  j  av  a  2 s.  c  o  m
 */
void doContextMenuAction(int itemId, Contact contact) {
    switch (itemId) {
    case R.id.contact_list_context_menu_call_item:
        try {
            mXmppFacade.call(contact.getJID() + "/psi");
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        break;
    case R.id.contact_list_context_menu_userinfo_alias:
        Dialog alias = new Alias(ContactList.this, mRoster, contact).create();
        alias.show();
        break;
    case R.id.contact_list_context_menu_userinfo_subscription:
        Dialog subscription = new ResendSubscription(ContactList.this, mXmppFacade, contact).create();
        subscription.show();
        break;
    case R.id.contact_list_context_menu_userinfo_delete:
        Dialog delete = new DeleteContact(ContactList.this, mRoster, contact).create();
        delete.show();
        break;
    default:
        LOGW(TAG, "Context menu action not supported" + itemId);
        break;
    }

}

From source file:com.beem.project.beem.ui.ContactList.java

@Override
public final boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.contact_list_menu_settings:
        startActivity(new Intent(this, Settings.class));
        return true;
    case R.id.contact_list_menu_add_contact:
        startActivity(new Intent(ContactList.this, AddContact.class));
        return true;
    case R.id.menu_change_status:
        startActivity(new Intent(ContactList.this, ChangeStatus.class));
        return true;
    case R.id.contact_list_menu_chatlist:
        List<Contact> openedChats;
        try {//from   w w w . j  ava2  s  .  c  om
            openedChats = mChatManager.getOpenedChatList();
            LOGD(TAG, "opened chats = " + openedChats);
            Dialog chatList = new ChatList(ContactList.this, openedChats).create();
            chatList.show();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return true;
    case R.id.menu_disconnect:
        stopService(SERVICE_INTENT);
        finish();
        return true;
    default:
        return false;
    }
}

From source file:com.baruckis.nanodegree.spotifystreamer.PlayerService.java

private void initMediaSession() {

    mSession = new MediaSessionCompat(getApplicationContext(), "media_player_session", null, null);

    try {//from  w w  w  .  ja va 2  s.c  om
        mController = new MediaControllerCompat(getApplicationContext(), mSession.getSessionToken());
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    mSession.setCallback(new MediaSessionCompat.Callback() {
        @Override
        public void onPlay() {
            if (mListener != null) {
                mListener.onPlayTrack();
            }
        }

        @Override
        public void onPause() {
            if (!mIsError && mListener != null) {
                mListener.onPauseTrack();
            }
            if (mIsError) {
                isPlaybackPausedByUser = true;
                buildNotification(generateAction(android.R.drawable.ic_media_play, "Play", ACTION_PLAY), false);
                if (mListener != null) {
                    mListener.onError();
                }
            }
        }

        @Override
        public void onSkipToNext() {
            if (mListener != null) {
                mListener.onNextTrack();
            }
        }

        @Override
        public void onSkipToPrevious() {
            if (mListener != null) {
                mListener.onPreviousTrack();
            }
        }
    });
}

From source file:com.amaze.filemanager.services.CopyService.java

private void publishResults(String a, int p1, int p2, int id, long total, long done, boolean b, boolean move) {
    if (hash.get(id)) {
        //notification
        mBuilder.setProgress(100, p1, false);
        mBuilder.setOngoing(true);//from w w w .j  av a 2  s.co m
        int title = R.string.copying;
        if (move)
            title = R.string.moving;
        mBuilder.setContentTitle(utils.getString(c, title));
        mBuilder.setContentText(new File(a).getName() + " " + utils.readableFileSize(done) + "/"
                + utils.readableFileSize(total));
        int id1 = Integer.parseInt("456" + id);
        mNotifyManager.notify(id1, mBuilder.build());
        if (p1 == 100 || total == 0) {
            mBuilder.setContentTitle("Copy completed");
            if (move)
                mBuilder.setContentTitle("Move Completed");
            mBuilder.setContentText("");
            mBuilder.setProgress(0, 0, false);
            mBuilder.setOngoing(false);
            mBuilder.setAutoCancel(true);
            mNotifyManager.notify(id1, mBuilder.build());
            publishCompletedResult(id, id1);
        }
        //for processviewer
        DataPackage intent = new DataPackage();
        intent.setName(a);
        intent.setTotal(total);
        intent.setDone(done);
        intent.setId(id);
        intent.setP1(p1);
        intent.setP2(p2);
        intent.setMove(move);
        intent.setCompleted(b);
        hash1.put(id, intent);
        try {
            if (progressListener != null) {
                progressListener.onUpdate(intent);
                if (b)
                    progressListener.refresh();
            }
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else
        publishCompletedResult(id, Integer.parseInt("456" + id));
}

From source file:com.turbulenz.turbulenz.googlepayment.java

public googlepayment(Activity activity, int purchaseRequestCode) {
    mActivity = activity;//  w  ww  .j a v  a  2 s .c o m
    mPurchaseRequestCode = purchaseRequestCode;

    // Just listens for connection / disconnection
    mServiceConnection = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            _log("service disconnected :(");
            mService = null;
            mReady = false;
            reportReady(false);
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            _log("service connected :)");
            mService = IInAppBillingService.Stub.asInterface(service);

            String packageName = mActivity.getPackageName();
            _log("checking for billing.3 in " + packageName + "...");
            try {
                int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                if (BILLING_RESPONSE_RESULT_OK == response) {
                    mReady = true;
                } else {
                    _log("billing v3 not supported for this package");
                }
            } catch (RemoteException e) {
                _error("remoteexception:");
                e.printStackTrace();
            }

            reportReady(mReady);
        }
    };

    _log("binding service ...");
    boolean bound = activity.bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"),
            mServiceConnection, Context.BIND_AUTO_CREATE);
    _log("back from bindService: bound: " + Boolean.toString(bound));
}

From source file:com.dynamixsoftware.printingsample.IntentApiFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    intentApi = new IntentAPI(getActivity() != null ? getActivity() : context); // some features not worked if initialized without activity
    final Context appContext = context.getApplicationContext();
    try {//w w w .  ja  va  2  s  .  c  om
        intentApi.runService(new IServiceCallback.Stub() {
            @Override
            public void onServiceDisconnected() {
                toastInMainThread(appContext, "Service disconnected");
            }

            @Override
            public void onServiceConnected() {
                toastInMainThread(appContext, "Service connected");
            }

            @Override
            public void onFileOpen(int progress, int finished) {
                toastInMainThread(appContext,
                        "onFileOpen progress " + progress + "; finished " + (finished == 1));
            }

            @Override
            public void onLibraryDownload(int progress) {
                toastInMainThread(appContext, "onLibraryDownload progress " + progress);
            }

            @Override
            public boolean onRenderLibraryCheck(boolean renderLibrary, boolean fontLibrary) {
                toastInMainThread(appContext, "onRenderLibraryCheck render library " + renderLibrary
                        + "; fonts library " + fontLibrary);
                return true;
            }

            @Override
            public String onPasswordRequired() {
                toastInMainThread(appContext, "onPasswordRequired");
                return "password";
            }

            @Override
            public void onError(Result result) {
                toastInMainThread(appContext, "error, Result " + result + "; Result type " + result.getType());
            }
        });
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    try {
        intentApi.setPrintCallback(new IPrintCallback.Stub() {
            @Override
            public void startingPrintJob() {
                toastInMainThread(appContext, "startingPrintJob");
            }

            @Override
            public void start() {
                toastInMainThread(appContext, "start");
            }

            @Override
            public void sendingPage(int pageNum, int progress) {
                toastInMainThread(appContext, "sendingPage number " + pageNum + ", progress " + progress);
            }

            @Override
            public void preparePage(int pageNum) {
                toastInMainThread(appContext, "preparePage number " + pageNum);
            }

            @Override
            public boolean needCancel() {
                toastInMainThread(appContext, "needCancel");
                // If you need to cancel printing send true
                return false;
            }

            @Override
            public void finishingPrintJob() {
                toastInMainThread(appContext, "finishingPrintJob");
            }

            @Override
            public void finish(Result result, int pagesPrinted) {
                toastInMainThread(appContext,
                        "finish, Result " + result + "; Result type " + result.getType() + "; Result message "
                                + result.getType().getMessage() + "; pages printed " + pagesPrinted);
            }
        });
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}