List of usage examples for android.os RemoteException printStackTrace
public void printStackTrace()
From source file:com.terracom.mumbleclient.app.QRPushToTalkActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem disconnectButton = menu.findItem(R.id.action_disconnect); try {// w ww .j a v a 2 s . c o m disconnectButton.setVisible(mService != null && mService.isConnected()); } catch (RemoteException e) { e.printStackTrace(); } // Color the action bar icons to the primary text color of the theme. int foregroundColor = getSupportActionBar().getThemedContext() .obtainStyledAttributes(new int[] { android.R.attr.textColor }).getColor(0, -1); for (int x = 0; x < menu.size(); x++) { MenuItem item = menu.getItem(x); if (item.getIcon() != null) { Drawable icon = item.getIcon().mutate(); // Mutate the icon so that the color filter is exclusive to the action bar icon.setColorFilter(foregroundColor, PorterDuff.Mode.MULTIPLY); } } return super.onPrepareOptionsMenu(menu); }
From source file:de.meisterfuu.animexxenger.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 ww. jav a2s. com openedChats = mChatManager.getOpenedChatList(); Log.d(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:bucci.dev.freestyle.TimerActivity.java
private void sendMessageToService(int messageType) { if (DEBUG)/*ww w. java 2 s .c om*/ Log.d(TAG, "sendMessageToService(" + messageType + ")"); Message msg = Message.obtain(); msg.what = messageType; switch (messageType) { case MSG_START_TIMER: if (isTimerResumed()) msg.obj = timeLeft; else msg.obj = startTime; break; case MSG_STOP_TIMER: if (DEBUG) Log.i(TAG, "startTime: " + startTime); msg.obj = startTime; break; } try { service.send(msg); } catch (RemoteException e) { if (DEBUG) Log.e(TAG, "sendMessage RemoteException, e: " + e.getMessage()); e.printStackTrace(); } }
From source file:cx.ring.fragments.CallListFragment.java
private void bindCalls(Conference call_to_add, Conference call_target) { try {//from w w w .j av a 2 s . c o m Log.i(TAG, "joining calls:" + call_to_add.getId() + " and " + call_target.getId()); if (call_target.hasMultipleParticipants() && !call_to_add.hasMultipleParticipants()) { mCallbacks.getService().getRemoteService() .addParticipant(call_to_add.getParticipants().get(0).getCallId(), call_target.getId()); } else if (call_target.hasMultipleParticipants() && call_to_add.hasMultipleParticipants()) { // We join two conferences mCallbacks.getService().getRemoteService().joinConference(call_to_add.getId(), call_target.getId()); } else if (!call_target.hasMultipleParticipants() && call_to_add.hasMultipleParticipants()) { mCallbacks.getService().getRemoteService() .addParticipant(call_target.getParticipants().get(0).getCallId(), call_to_add.getId()); } else { // We join two single calls to create a conf mCallbacks.getService().getRemoteService().joinParticipant( call_to_add.getParticipants().get(0).getCallId(), call_target.getParticipants().get(0).getCallId()); } } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.dmfs.tasks.notification.NotificationUpdaterService.java
private void markCompleted(Uri taskUri) { ContentResolver contentResolver = getContentResolver(); ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(1); ContentProviderOperation.Builder operation = ContentProviderOperation.newUpdate(taskUri); operation.withValue(Tasks.STATUS, Tasks.STATUS_COMPLETED); operation.withValue(Tasks.PINNED, false); operations.add(operation.build());/*from w ww . j a v a2 s . co m*/ try { contentResolver.applyBatch(mAuthority, operations); } catch (RemoteException e) { Log.e(TAG, "Remote exception during complete task action"); e.printStackTrace(); } catch (OperationApplicationException e) { Log.e(TAG, "Unable to mark task completed: " + taskUri); e.printStackTrace(); } }
From source file:com.terracom.mumbleclient.app.QRPushToTalkActivity.java
/** * Loads a fragment from the drawer./*from w ww . j av a2 s .c om*/ */ private void loadDrawerFragment(int fragmentId) { Class<? extends Fragment> fragmentClass = null; Bundle args = new Bundle(); switch (fragmentId) { case DrawerAdapter.ITEM_SERVER: fragmentClass = ChannelFragment.class; break; case DrawerAdapter.ITEM_INFO: fragmentClass = ServerInfoFragment.class; break; case DrawerAdapter.ITEM_ACCESS_TOKENS: fragmentClass = AccessTokenFragment.class; try { args.putLong("server", mService.getConnectedServer().getId()); args.putStringArrayList("access_tokens", (ArrayList<String>) mDatabase.getAccessTokens(mService.getConnectedServer().getId())); } catch (RemoteException e) { e.printStackTrace(); } break; case DrawerAdapter.ITEM_PINNED_CHANNELS: fragmentClass = ChannelFragment.class; args.putBoolean("pinned", true); break; case DrawerAdapter.ITEM_FAVOURITES: fragmentClass = FavouriteServerListFragment.class; break; case DrawerAdapter.ITEM_PUBLIC: fragmentClass = PublicServerListFragment.class; break; case DrawerAdapter.ITEM_SETTINGS: Intent prefIntent = new Intent(this, Preferences.class); startActivity(prefIntent); return; default: return; } Fragment fragment = Fragment.instantiate(this, fragmentClass.getName(), args); getSupportFragmentManager().beginTransaction() .replace(R.id.content_frame, fragment, fragmentClass.getName()) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit(); setTitle(mDrawerAdapter.getItemWithId(fragmentId).title); }
From source file:com.terracom.mumbleclient.app.QRPushToTalkActivity.java
public void connectToServer(final Server server) { // Check if we're already connected to a server; if so, inform user. try {/*from w w w.j a v a 2 s. co m*/ if (mService != null && mService.isConnected()) { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setMessage(R.string.reconnect_dialog_message); adb.setPositiveButton(R.string.connect, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { // Register an observer to reconnect to the new server once disconnected. mService.registerObserver(new JumbleObserver() { @Override public void onDisconnected() throws RemoteException { connectToServer(server); mService.unregisterObserver(this); } }); mService.disconnect(); } catch (RemoteException e) { e.printStackTrace(); } } }); adb.setNegativeButton(android.R.string.cancel, null); adb.show(); return; } } catch (RemoteException e) { e.printStackTrace(); } // Prompt to start Orbot if enabled but not running if (mSettings.isTorEnabled()) { OrbotHelper orbotHelper = new OrbotHelper(this); if (!orbotHelper.isOrbotRunning()) { orbotHelper.requestOrbotStart(this); return; } } mConnectingDialog.setMessage(getString(R.string.connecting_to_server, server.getHost(), server.getPort())); mConnectingDialog.show(); ServerConnectTask connectTask = new ServerConnectTask(this, mDatabase); connectTask.execute(server); }
From source file:cx.ring.fragments.CallListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Conference transfer;// ww w .ja v a 2 s .c om if (requestCode == REQUEST_TRANSFER) { switch (resultCode) { case 0: Conference c = data.getParcelableExtra("target"); transfer = data.getParcelableExtra("transfer"); try { mCallbacks.getService().getRemoteService().attendedTransfer( transfer.getParticipants().get(0).getCallId(), c.getParticipants().get(0).getCallId()); mConferenceAdapter.notifyDataSetChanged(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } Toast.makeText(getActivity(), getString(cx.ring.R.string.home_transfer_complet), Toast.LENGTH_LONG) .show(); break; case 1: String to = data.getStringExtra("to_number"); transfer = data.getParcelableExtra("transfer"); try { Toast.makeText(getActivity(), getString(cx.ring.R.string.home_transfering, transfer.getParticipants().get(0).getContact().getDisplayName(), to), Toast.LENGTH_SHORT).show(); mCallbacks.getService().getRemoteService() .transfer(transfer.getParticipants().get(0).getCallId(), to); mCallbacks.getService().getRemoteService() .hangUp(transfer.getParticipants().get(0).getCallId()); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } break; default: break; } } else if (requestCode == REQUEST_CONF) { switch (resultCode) { case 0: Conference call_to_add = data.getParcelableExtra("transfer"); Conference call_target = data.getParcelableExtra("target"); bindCalls(call_to_add, call_target); break; default: break; } } }
From source file:org.gege.caldavsyncadapter.syncadapter.SyncAdapter.java
/** * checks the android events for the dirty flag. * the flag is set by android when the event has been changed. * the dirty flag is removed when an android event has been updated from calendar event * @param provider//from www . j ava 2s.c o m * @param account * @param calendarUri * @param facade * @param caldavCalendarUri * @param stats * @param notifyList * @return count of dirty events */ private int checkDirtyAndroidEvents(ContentProviderClient provider, Account account, Uri calendarUri, CaldavFacade facade, URI caldavCalendarUri, SyncStats stats, ArrayList<Uri> notifyList) { Cursor curEvent = null; Cursor curAttendee = null; Cursor curReminder = null; Long EventID; Long CalendarID; AndroidEvent androidEvent = null; int rowDirty = 0; int rowInsert = 0; int rowUpdate = 0; int rowDelete = 0; try { CalendarID = ContentUris.parseId(calendarUri); String selection = "(" + Events.DIRTY + " = ?) AND (" + Events.CALENDAR_ID + " = ?)"; String[] selectionArgs = new String[] { "1", CalendarID.toString() }; curEvent = provider.query(Events.CONTENT_URI, null, selection, selectionArgs, null); while (curEvent.moveToNext()) { EventID = curEvent.getLong(curEvent.getColumnIndex(Events._ID)); Uri returnedUri = ContentUris.withAppendedId(Events.CONTENT_URI, EventID); androidEvent = new AndroidEvent(account, provider, returnedUri, calendarUri); androidEvent.readContentValues(curEvent); selection = "(" + Attendees.EVENT_ID + " = ?)"; selectionArgs = new String[] { String.valueOf(EventID) }; curAttendee = provider.query(Attendees.CONTENT_URI, null, selection, selectionArgs, null); selection = "(" + Reminders.EVENT_ID + " = ?)"; selectionArgs = new String[] { String.valueOf(EventID) }; curReminder = provider.query(Reminders.CONTENT_URI, null, selection, selectionArgs, null); androidEvent.readAttendees(curAttendee); androidEvent.readReminder(curReminder); curAttendee.close(); curReminder.close(); String SyncID = androidEvent.ContentValues.getAsString(Events._SYNC_ID); boolean Deleted = false; int intDeleted = 0; intDeleted = curEvent.getInt(curEvent.getColumnIndex(Events.DELETED)); Deleted = (intDeleted == 1); if (SyncID == null) { // new Android event String newGUID = java.util.UUID.randomUUID().toString() + "-caldavsyncadapter"; String calendarPath = caldavCalendarUri.getPath(); if (!calendarPath.endsWith("/")) calendarPath += "/"; SyncID = calendarPath + newGUID + ".ics"; androidEvent.createIcs(newGUID); if (facade.createEvent(URI.create(SyncID), androidEvent.getIcsEvent().toString())) { //HINT: bugfix for google calendar if (SyncID.contains("@")) SyncID = SyncID.replace("@", "%40"); ContentValues values = new ContentValues(); values.put(Events._SYNC_ID, SyncID); //google doesn't send the etag after creation //HINT: my SabreDAV send always the same etag after putting a new event //String LastETag = facade.getLastETag(); //if (!LastETag.equals("")) { // values.put(Event.ETAG, LastETag); //} else { //so get the etag with a new REPORT CalendarEvent calendarEvent = new CalendarEvent(account, provider); calendarEvent.calendarURL = caldavCalendarUri.toURL(); URI SyncURI = new URI(SyncID); calendarEvent.setUri(SyncURI); CaldavFacade.getEvent(calendarEvent); values.put(Event.ETAG, calendarEvent.getETag()); //} values.put(Event.UID, newGUID); values.put(Events.DIRTY, 0); values.put(Event.RAWDATA, androidEvent.getIcsEvent().toString()); int rowCount = provider.update( asSyncAdapter(androidEvent.getUri(), account.name, account.type), values, null, null); if (rowCount == 1) { rowInsert += 1; notifyList.add(androidEvent.getUri()); } } } else if (Deleted) { // deleted Android event if (facade.deleteEvent(URI.create(SyncID), androidEvent.getETag())) { String mSelectionClause = "(" + Events._ID + "= ?)"; String[] mSelectionArgs = { String.valueOf(EventID) }; int countDeleted = provider.delete( asSyncAdapter(Events.CONTENT_URI, account.name, account.type), mSelectionClause, mSelectionArgs); if (countDeleted == 1) { rowDelete += 1; notifyList.add(androidEvent.getUri()); } } } else { //update the android event to the server String uid = androidEvent.getUID(); if ((uid == null) || (uid.equals(""))) { //COMPAT: this is needed because in the past, the UID was not stored in the android event CalendarEvent calendarEvent = new CalendarEvent(account, provider); URI syncURI = new URI(SyncID); calendarEvent.setUri(syncURI); calendarEvent.calendarURL = caldavCalendarUri.toURL(); if (calendarEvent.fetchBody()) { calendarEvent.readContentValues(); uid = calendarEvent.getUID(); } } if (uid != null) { androidEvent.createIcs(uid); if (facade.updateEvent(URI.create(SyncID), androidEvent.getIcsEvent().toString(), androidEvent.getETag())) { selection = "(" + Events._ID + "= ?)"; selectionArgs = new String[] { EventID.toString() }; androidEvent.ContentValues.put(Events.DIRTY, 0); //google doesn't send the etag after update String LastETag = facade.getLastETag(); if (!LastETag.equals("")) { androidEvent.ContentValues.put(Event.ETAG, LastETag); } else { //so get the etag with a new REPORT CalendarEvent calendarEvent = new CalendarEvent(account, provider); calendarEvent.calendarURL = caldavCalendarUri.toURL(); URI SyncURI = new URI(SyncID); calendarEvent.setUri(SyncURI); CaldavFacade.getEvent(calendarEvent); androidEvent.ContentValues.put(Event.ETAG, calendarEvent.getETag()); } androidEvent.ContentValues.put(Event.RAWDATA, androidEvent.getIcsEvent().toString()); int RowCount = provider.update( asSyncAdapter(androidEvent.getUri(), account.name, account.type), androidEvent.ContentValues, null, null); if (RowCount == 1) { rowUpdate += 1; notifyList.add(androidEvent.getUri()); } } else { rowDirty += 1; } } else { rowDirty += 1; } } } curEvent.close(); /*if ((rowInsert > 0) || (rowUpdate > 0) || (rowDelete > 0) || (rowDirty > 0)) { Log.i(TAG,"Android Rows inserted: " + String.valueOf(rowInsert)); Log.i(TAG,"Android Rows updated: " + String.valueOf(rowUpdate)); Log.i(TAG,"Android Rows deleted: " + String.valueOf(rowDelete)); Log.i(TAG,"Android Rows dirty: " + String.valueOf(rowDirty)); }*/ stats.numInserts += rowInsert; stats.numUpdates += rowUpdate; stats.numDeletes += rowDelete; stats.numSkippedEntries += rowDirty; stats.numEntries += rowInsert + rowUpdate + rowDelete; } catch (RemoteException e) { e.printStackTrace(); } catch (URISyntaxException e) { // TODO Automatisch generierter Erfassungsblock e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Automatisch generierter Erfassungsblock e.printStackTrace(); } catch (IOException e) { // TODO Automatisch generierter Erfassungsblock e.printStackTrace(); } catch (CaldavProtocolException e) { // TODO Automatisch generierter Erfassungsblock e.printStackTrace(); } catch (ParserException e) { // TODO Automatisch generierter Erfassungsblock e.printStackTrace(); } return rowDirty; }
From source file:cm.aptoide.pt.services.ServiceDownloadManager.java
/** * startDownload, starts managing the received download, and starts the download itself, * to be called by ViewDownloadManagement.startDownload() or by restart() * * @param ViewDownloadManagement//from w ww .ja v a 2 s . c o m */ public void startDownload(final ViewDownloadManagement viewDownload) { Log.d("Aptoide", "download being started *************** " + viewDownload.hashCode()); checkDirectorySize(Environment.getExternalStorageDirectory().getAbsolutePath() + "/.aptoide/apks"); // ViewCache cache = viewDownload.getCache(); // if(cache.isCached() && cache.hasMd5Sum() && cache.checkMd5()){ // // // // if(viewDownload.isInstall()){ // installApp(cache, viewDownload.isObb()); // } // // // }else{ // if(isPermittedConnectionAvailable()){ if (!ongoingDownloads.containsKey(viewDownload.hashCode())) { ongoingDownloads.put(viewDownload.hashCode(), viewDownload); } else switch (ongoingDownloads.get(viewDownload.hashCode()).getDownloadStatus()) { case SETTING_UP: case PAUSED: case RESUMING: case RESTARTING: break; default: return; } cachedThreadPool.execute(new Runnable() { @Override public void run() { if (viewDownload.isLoginRequired()) { // if (viewDownload.getViewMainObbDownload() != null) { // helperDownload.downloadPrivateApk(viewDownload.getViewMainObbDownload(), viewDownload.getObb().getMainCache(), viewDownload.getLogin(), false); // if (viewDownload.getViewPatchObbDownload() != null) { // helperDownload.downloadPrivateApk(viewDownload.getViewPatchObbDownload(), viewDownload.getObb().getPatchCache(), viewDownload.getLogin(), false); // } // } helperDownload.downloadPrivateApk(viewDownload.getDownload(), viewDownload.getCache(), viewDownload.getLogin(), viewDownload.getAppInfo().isPaid()); } else { // if (viewDownload.getViewMainObbDownload() != null) { // helperDownload.downloadApk(viewDownload.getViewMainObbDownload(), viewDownload.getObb().getMainCache(), false); // if (viewDownload.getViewPatchObbDownload() != null) { // helperDownload.downloadApk(viewDownload.getViewPatchObbDownload(), viewDownload.getObb().getPatchCache(), false); // } // } helperDownload.downloadApk(viewDownload.getDownload(), viewDownload.getCache(), viewDownload.getAppInfo().isPaid()); } } }); updateGlobalProgress(); if (isDownloadManagerRegistered()) { try { downloadManager.updateDownloadStatus(EnumDownloadStatus.SETTING_UP.ordinal()); } catch (RemoteException e) { e.printStackTrace(); } } // } // } }