Example usage for android.os Bundle containsKey

List of usage examples for android.os Bundle containsKey

Introduction

In this page you can find the example usage for android.os Bundle containsKey.

Prototype

public boolean containsKey(String key) 

Source Link

Document

Returns true if the given key is contained in the mapping of this Bundle.

Usage

From source file:de.hackerspacebremen.fragments.ChangeStatusFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    Bundle extras = getArguments();//from ww w. java2s  .  c o m
    if (savedInstanceState != null && savedInstanceState.containsKey("change_json")
            && savedInstanceState.getString("change_json") != null) {
        this.change = ChangeDataJsonParser.parse(savedInstanceState.getString("change_json"));
    } else if (extras != null && extras.containsKey("change_json") && extras.getString("change_json") != null) {
        this.change = ChangeDataJsonParser.parse(extras.getString("change_json"));
    }
    super.onCreate(savedInstanceState);
}

From source file:dev.drsoran.moloko.sync.SyncAdapter.java

private final boolean shouldProcessRequest(Bundle bundle) {
    return (bundle != null && (bundle.containsKey(ContentResolver.SYNC_EXTRAS_INITIALIZE)
            || bundle.containsKey(ContentResolver.SYNC_EXTRAS_MANUAL)
            || bundle.containsKey(dev.drsoran.moloko.sync.Constants.SYNC_EXTRAS_SCHEDULED)));
}

From source file:app.hacked.ScheduleListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // Restore the previously serialized activated item position.
    if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
        setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
    }/*from w w w  .  j a v  a2  s.co  m*/

    if (getActivity().findViewById(R.id.ScheduleDetails) != null && savedInstanceState == null) {
        ScheduleWelcomeFragment fragment = new ScheduleWelcomeFragment();
        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.ScheduleDetails, fragment)
                .commit();
    }

    getData();

    /*if(savedInstanceState != null)
    progressBar.setVisibility(View.GONE);*/
}

From source file:com.anstar.fieldwork.CaptureSignatureFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle b = getArguments();
    if (b != null) {
        if (b.containsKey("cutomer")) {
            signtype = b.getString("cutomer");
        }//from  w  w  w .j a  v  a 2s .c om
        if (b.containsKey("tech")) {
            signtype = b.getString("tech");
        }
        if (b.containsKey(Const.Appointment_Id)) {
            a_id = b.getInt(Const.Appointment_Id);
        }
    }
    m_points = new ArrayList<>();
    appointment_info = AppointmentModelList.Instance().getAppointmentById(a_id);
}

From source file:biz.incomsystems.fwknop2.ConfigListFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // Restore the previously serialized activated item position.
    if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
        setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
    }/*from w  w  w .j  av a  2s . com*/

}

From source file:br.com.anteros.social.instagram.AnterosInstagramSession.java

private boolean checkTokenError(Bundle result) {
    if (result != null && result.containsKey(ERROR_CODE) && result.getString(ERROR_CODE).contains("400")
            && result.getString(ERROR_CODE).contains("OAuth")) {
        restart = true;//from  w  w w  .  j  a v  a2s .c o m
        requestBundle = result;
        requestBundle.remove(ERROR_CODE);
        requestBundle.remove(AnterosInstagramAsyncTask.RESULT_ERROR);
        login();
        return true;
    }
    return false;
}

From source file:com.anstar.fieldwork.CaptureSignatureActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.capture_siganture);

    ActionBar action = getSupportActionBar();
    action = getSupportActionBar();//from  w  ww  .  j  a  v  a 2s.c  o  m
    // action.setTitle("Signature");
    action.setTitle(Html
            .fromHtml("<font color='" + getString(R.string.header_text_color) + "'>Capture Signature</font>"));
    action.setHomeButtonEnabled(true);
    action.setDisplayHomeAsUpEnabled(true);

    Bundle b = getIntent().getExtras();
    if (b != null) {
        if (b.containsKey("cutomer")) {
            signtype = b.getString("cutomer");
        }
        if (b.containsKey("tech")) {
            signtype = b.getString("tech");
        }
        if (b.containsKey(Const.Appointment_Id)) {
            a_id = b.getInt(Const.Appointment_Id);
        }
    }
    appointment_info = AppointmentModelList.Instance().getAppointmentById(a_id);
    llSignCanvas = (LinearLayout) findViewById(R.id.llSignCanvas);
    txtSignType = (TextView) findViewById(R.id.txtSignatureType);
    txtSignName = (TextView) findViewById(R.id.txtSignName);
    txtLicInfo = (TextView) findViewById(R.id.txtSignLic);
    btnCancel = (Button) findViewById(R.id.btnCancel);
    btnClear = (Button) findViewById(R.id.btnClear);
    btnSave = (Button) findViewById(R.id.btnSave);
    m_points = new ArrayList<SignaturePoints>();
    loadView load = new loadView();
    load.execute();
    btnCancel.setOnClickListener(this);
    btnClear.setOnClickListener(this);
    btnSave.setOnClickListener(this);
}

From source file:com.example.drugsformarinemammals.Listview_DrugResults.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview_drugresults);
    helper = new Handler_Sqlite(this);
    Bundle extra = this.getIntent().getExtras();

    if (extra.containsKey("drugList")) {
        //option Combined Search
        drugList = (ArrayList<String>) extra.get("drugList");

    } else {/*from  w  ww  . jav  a2 s  . co m*/
        fiveLastScreen = (Boolean) extra.get("fiveLastScreen");
        //option Five Last Searched
        orderDrugsByPriority();
    }
    ListAdapter adapter = new ItemAdapterDrugResults(this, drugList);
    ListView listview = (ListView) findViewById(R.id.drugsresult);
    listview.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String drugName = drugList.get(position);
            if (!helper.existDrug(drugName)) {
                String[] urls = { "http://formmulary.tk/Android/getGeneralInfoDrug.php?drug_name=",
                        "http://formmulary.tk/Android/getInfoCodes.php?drug_name=" };
                boolean sync = false;
                new GetGeneralInfoDrug(drugName, sync).execute(urls);
            } else {
                Intent intent = new Intent(getApplicationContext(), General_Info_Drug.class);
                intent.putExtra("drugName", drugName);
                intent.putExtra("fiveLastScreen", fiveLastScreen);
                startActivity(intent);
                if (fiveLastScreen)
                    finish();
            }
        }
    });

    listview.setAdapter(adapter);
}

From source file:com.ntsync.android.sync.client.NetworkUtilities.java

/**
 * /* ww  w. j a  va2 s.com*/
 * @param acm
 * @param account
 * 
 * 
 * @param Activity
 *            if null show a notification when Login is needed otherwise
 *            show the Login-Activity in the context of the provided
 *            Activity. *
 * @return SessionId
 * @throws OperationCanceledException
 * @throws ServerException
 * @throws NetworkErrorException
 */
@SuppressWarnings("deprecation")
public static String blockingGetAuthToken(AccountManager acm, Account account, Activity activity)
        throws OperationCanceledException, ServerException, NetworkErrorException {
    String authToken = null;
    try {
        Bundle result;
        if (activity == null) {
            // New is available from API 14 -> use deprecated API
            result = acm.getAuthToken(account, Constants.AUTHTOKEN_TYPE, true, null, null).getResult();
        } else {
            result = acm.getAuthToken(account, Constants.AUTHTOKEN_TYPE, null, activity, null, null)
                    .getResult();
        }
        if (result != null) {
            if (result.containsKey(AccountManager.KEY_AUTHTOKEN)) {
                authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
            }
            if (result.containsKey(AccountManager.KEY_ERROR_CODE)) {
                int errorCode = result.getInt(AccountManager.KEY_ERROR_CODE, -1);
                String msg = result.getString(AccountManager.KEY_ERROR_MESSAGE);
                if (errorCode == Constants.AUTH_ERRORCODE_SERVEREXCEPTION) {
                    throw new ServerException(msg);
                } else {
                    LogHelper.logE(TAG,
                            "Authentification failed with unknown errorCode:" + errorCode + " Message:" + msg,
                            null);
                }
            }
        }
    } catch (AuthenticatorException e) {
        LogHelper.logE(TAG, "Authentification failed.", e);
        // Should not happen -> report error
        ErrorHandler.reportException(e);
    } catch (IOException ex) {
        throw new NetworkErrorException(ex);
    }
    return authToken;
}

From source file:com.spoiledmilk.ibikecph.favorites.EditFavoriteFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data != null) {
        Bundle b = data.getExtras();
        if (b.containsKey("address") && b.containsKey("lat") && b.containsKey("lon")) {
            favoritesData.setAdress(AddressParser.textFromBundle(b).replaceAll("\n", ""));
            favoritesData.setLatitude(b.getDouble("lat"));
            favoritesData.setLongitude(b.getDouble("lon"));
            String txt = favoritesData.getAdress();
            textAddress.setText(txt);/*from w  ww.j a  v  a 2s .c  om*/
            if (b.containsKey("poi")) {
                favoritesData.setName(b.getString("poi"));
            }
        }
    }

}