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.terracom.mumbleclient.channel.comment.AbstractCommentFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View view = inflater.inflate(R.layout.dialog_comment, null, false);

    mCommentView = (WebView) view.findViewById(R.id.comment_view);
    mCommentEdit = (EditText) view.findViewById(R.id.comment_edit);

    mTabHost = (TabHost) view.findViewById(R.id.comment_tabhost);
    mTabHost.setup();//  w w w. j av a2  s  . co m

    if (mComment == null) {
        mCommentView.loadData("Loading...", null, null);
        try {
            requestComment(mProvider.getService());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else {
        loadComment(mComment);
    }

    TabHost.TabSpec viewTab = mTabHost.newTabSpec("View");
    viewTab.setIndicator(getString(R.string.comment_view));
    viewTab.setContent(R.id.comment_tab_view);

    TabHost.TabSpec editTab = mTabHost.newTabSpec("Edit");
    editTab.setIndicator(getString(isEditing() ? R.string.comment_edit_source : R.string.comment_view_source));
    editTab.setContent(R.id.comment_tab_edit);

    mTabHost.addTab(viewTab);
    mTabHost.addTab(editTab);

    mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if ("View".equals(tabId)) {
                // When switching back to view tab, update with user's HTML changes.
                mCommentView.loadData(mCommentEdit.getText().toString(), "text/html", "UTF-8");
            } else if ("Edit".equals(tabId) && "".equals(mCommentEdit.getText().toString())) {
                // Load edittext content for the first time when the tab is selected, to improve performance with long messages.
                mCommentEdit.setText(mComment);
            }
        }
    });

    mTabHost.setCurrentTab(isEditing() ? 1 : 0);

    AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
    adb.setView(view);
    if (isEditing()) {
        adb.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                try {
                    editComment(mProvider.getService(), mCommentEdit.getText().toString());
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        });
    }
    adb.setNegativeButton(R.string.close, null);
    return adb.create();
}

From source file:org.ohmage.streams.StreamWriter.java

/**
 * is called once the bind succeeds/*from   www  . j av a2s. c  o m*/
 */
@Override
public synchronized void onServiceConnected(ComponentName name, IBinder service) {
    dataService = IStreamReceiver.Stub.asInterface(service);

    if (mListener != null)
        mListener.onServiceConnected(this);

    // Write any streams which came before we were connected
    for (StreamPointBuilder stream : mBuffer) {
        try {
            stream.write(this);
        } catch (RemoteException e) {
            // Remote connection was lost
            e.printStackTrace();
        }
    }
    mBuffer.clear();

    if (mShouldClose) {
        close();
    }
}

From source file:org.gateshipone.odyssey.fragments.BookmarksFragment.java

/**
 * Call the PBS to play the selected bookmark.
 * A previous playlist will be cleared.//w w  w  .ja v a  2s .  com
 *
 * @param position the position of the selected bookmark in the adapter
 */
private void resumeBookmark(int position) {
    // identify current bookmark
    BookmarkModel bookmark = (BookmarkModel) mAdapter.getItem(position);

    // resume state
    try {
        mServiceConnection.getPBS().resumeBookmark(bookmark.getId());
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.gateshipone.odyssey.fragments.BookmarksFragment.java

/**
 * Call the PBS to delete the selected bookmark.
 *
 * @param position the position of the selected bookmark in the adapter
 *//*from  w ww. j a  v  a  2  s  .  c om*/
private void deleteBookmark(int position) {
    // identify current bookmark
    BookmarkModel bookmark = (BookmarkModel) mAdapter.getItem(position);

    // delete state
    try {
        mServiceConnection.getPBS().deleteBookmark(bookmark.getId());

        refreshContent();
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.continuesvoicerecognition.MainActivity.java

@Override
public void onClick(View v) {
    if (PermissionHandler.checkPermission(this, PermissionHandler.RECORD_AUDIO)) {
        Message msg = new Message();

        switch (v.getId()) {
        case R.id.start_listen_btn:
            msg.what = SpeechRecognizerService.MSG_RECOGNIZER_START_LISTENING;

            try {
                mServiceMessenger.send(msg);
            } catch (RemoteException e) {
                e.printStackTrace();
            }//from w w  w.  ja  v a 2  s.co  m
            result_tv.setText(getString(R.string.you_may_speak));
            break;
        case R.id.stop_listen_btn:
            msg.what = SpeechRecognizerService.MSG_RECOGNIZER_STOP_LISTENING;

            try {
                mServiceMessenger.send(msg);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            break;
        case R.id.mute:
            msg.what = SpeechRecognizerService.MSG_RECOGNIZER_TOGGLE_MUTE;

            try {
                mServiceMessenger.send(msg);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            break;
        }
    } else {
        PermissionHandler.askForPermission(PermissionHandler.RECORD_AUDIO, this);
    }
}

From source file:org.hedgewars.hedgeroid.Downloader.DownloadFragment.java

public void unBindFromService() {
    if (messengerService != null) {
        try {/*from w  ww  . j a va2  s. c  o  m*/
            Message message = Message.obtain(messageHandler, DownloadService.MSG_UNREGISTER_CLIENT, pack);
            message.replyTo = messenger;
            messengerService.send(message);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    getActivity().unbindService(connection);
}

From source file:wseemann.media.fmpdemo.activity.FMPDemo.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fmpdemo);
    /*? refer to  http://stackoverflow.com/questions/33129884/mediascannerconnection-fails-on-android-6-because-of-permission-denial*/
    myCheckPermission();/*  ww  w  .j a v a 2s . c o m*/

    final EditText uriText = (EditText) findViewById(R.id.uri);
    // Uncomment for debugging
    uriText.setText("http://192.168.10.22:8888/LSS_WFU.mp3");

    Intent intent = getIntent();

    // Populate the edit text field with the intent uri, if available
    Uri uri = intent.getData();

    if (intent.getExtras() != null && intent.getExtras().getCharSequence(Intent.EXTRA_TEXT) != null) {
        uri = Uri.parse(intent.getExtras().getCharSequence(Intent.EXTRA_TEXT).toString());
    }

    if (uri != null) {
        try {
            uriText.setText(URLDecoder.decode(uri.toString(), "UTF-8"));
        } catch (UnsupportedEncodingException e1) {
        }
    }

    setIntent(null);

    Button goButton = (Button) findViewById(R.id.go_button);
    goButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // Clear the error message
            uriText.setError(null);

            // Hide the keyboard
            InputMethodManager imm = (InputMethodManager) FMPDemo.this
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(uriText.getWindowToken(), 0);

            String uri = uriText.getText().toString();

            if (uri.equals("")) {
                uriText.setError(getString(R.string.uri_error));
                return;
            }

            String uriString = uriText.getText().toString();

            try {
                long[] list = new long[1];
                list[0] = MusicUtils.insert(FMPDemo.this, uriString);

                mService.open(list, 0);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    });

    mToken = MusicUtils.bindToService(this, this);
}

From source file:de.luhmer.owncloudnewsreader.services.OwnCloudSyncService.java

private void ThrowException(Exception ex) {
    List<IOwnCloudSyncServiceCallback> callbackList = getCallBackItemsAndBeginBroadcast();
    for (IOwnCloudSyncServiceCallback icb : callbackList) {
        try {// w w  w  .  j a  v a  2 s.c om
            icb.throwException(new AidlException(ex));
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    callbacks.finishBroadcast();
}

From source file:com.github.michalbednarski.intentslab.bindservice.InvokeAidlMethodFragment.java

private void invokeAidlMethod() {
    try {/*  ww w .j av a 2s. c  o  m*/
        InvokeMethodResult result;
        final IRemoteInterface runAs = RunAsManager.getSelectedRemoteInterface();
        if (runAs != null) {
            result = mAidlInterface.invokeMethodUsingBinder(
                    runAs.createOneShotProxyBinder(getServiceHelper().getBinderIfAvailable()), mMethodNumber,
                    mArgumentsEditorHelper.getSandboxedArguments());
        } else {
            result = mAidlInterface.invokeMethod(mMethodNumber, mArgumentsEditorHelper.getSandboxedArguments());
        }
        if (result.exception == null) { // True if there weren't error
            if (!"null".equals(result.returnValueAsString)) {
                ResultDialog resultDialog = new ResultDialog();
                Bundle args = new Bundle();
                args.putString(ResultDialog.ARG_RESULT_AS_STRING, result.returnValueAsString);
                args.putParcelable(ResultDialog.ARG_RESULT, result.sandboxedReturnValue);
                resultDialog.setArguments(args);
                resultDialog.show(getFragmentManager(), "ResultOf" + getTag());
            } else {
                Toast.makeText(getActivity(), result.returnValueAsString, Toast.LENGTH_LONG).show();
            }
            return;
        } else {
            Toast.makeText(getActivity(), result.exception, Toast.LENGTH_LONG).show();
            return;
        }
    } catch (RemoteException e) {
        e.printStackTrace();
        // Fall through
    }
    Toast.makeText(getActivity(), "Something went wrong...", Toast.LENGTH_SHORT).show(); // Should never happen
}

From source file:de.luhmer.owncloudnewsreader.services.OwnCloudSyncService.java

private void startedSync() {
    syncRunning = true;/*from  ww  w. ja va 2s .co  m*/
    Log.v(TAG, "Synchronization started");

    List<IOwnCloudSyncServiceCallback> callbackList = getCallBackItemsAndBeginBroadcast();
    for (IOwnCloudSyncServiceCallback icb : callbackList) {
        try {
            icb.startedSync();
            //icb.finishedSyncOfItems();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    callbacks.finishBroadcast();
}