public Void doInBackground(Void... aParams) { if (!isCancelled()) { try { NetworkUtils.get(Constants.BASE_URL + lrUrl); } catch (Exception e) { e.printStackTrace(); Log.i(TAG, e.toString()); } } return null; }
public Void doInBackground(Void... aParams) { if (!isCancelled()) { HashMap<String, String> params = new HashMap<String, String>(); params.put(Constants.PARAM_THREAD_ID, Integer.toString(mId)); if (removeBookmark) { params.put(Constants.PARAM_ACTION, "remove"); } else { params.put(Constants.PARAM_ACTION, "add"); } try { NetworkUtils.post(Constants.FUNCTION_BOOKMARK, params); } catch (Exception e) { Log.i(TAG, e.toString()); } } return null; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: startActivity(new Intent().setClass(this, SettingsActivity.class)); return true; case R.id.logout: NetworkUtils.clearLoginCookies(this); startActivityForResult(new Intent().setClass(this, AwfulLoginActivity.class), 0); return true; case R.id.refresh: mFetchTask = new FetchThreadsTask(); mFetchTask.execute(mForum.getForumId()); return true; default: return super.onOptionsItemSelected(item); } }
public void onCreate() { loggedIn = NetworkUtils.restoreLoginCookies(this); PreferenceManager.setDefaultValues(this, R.xml.settings, false); Log.e(TAG, "Service started."); }