Example usage for android.os Bundle getStringArrayList

List of usage examples for android.os Bundle getStringArrayList

Introduction

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

Prototype

@Override
@Nullable
public ArrayList<String> getStringArrayList(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:se.tmeit.app.ui.members.MemberInfoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_member_info, container, false);

    Bundle args = getArguments();
    TextView realNameText = (TextView) view.findViewById(R.id.member_real_name);
    realNameText.setText(args.getString(Member.Keys.REAL_NAME));

    TextView usernameText = (TextView) view.findViewById(R.id.member_username);
    usernameText.setText(args.getString(Member.Keys.USERNAME));

    TextView titleText = (TextView) view.findViewById(R.id.member_title);
    setTextWithPrefix(titleText, R.string.member_title, args.getString(Member.Keys.TITLE_TEXT));

    TextView teamText = (TextView) view.findViewById(R.id.member_team);
    setTextWithPrefix(teamText, R.string.member_team, args.getString(Member.Keys.TEAM_TEXT));

    ImageView imageView = (ImageView) view.findViewById(R.id.member_face);
    List<String> faces = args.getStringArrayList(Member.Keys.FACES);
    if (null != faces && !faces.isEmpty()) {
        mFaceHelper.picasso(faces).placeholder(R.drawable.member_placeholder).into(imageView);

        imageView.setOnClickListener(mOnImageClickedListener);
    } else {//w w  w.  ja  v a2s  .c o m
        imageView.setImageResource(R.drawable.member_placeholder);
    }

    final String email = args.getString(Member.Keys.EMAIL);
    Button emailButton = (Button) view.findViewById(R.id.member_button_email);
    if (!TextUtils.isEmpty(email)) {
        emailButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MemberActions.sendEmailTo(email, MemberInfoFragment.this);
            }
        });
        emailButton.setEnabled(true);
    } else {
        emailButton.setEnabled(false);
    }

    final String phoneNo = args.getString(Member.Keys.PHONE);
    Button smsButton = (Button) view.findViewById(R.id.member_button_message);
    Button callButton = (Button) view.findViewById(R.id.member_button_call);

    if (!TextUtils.isEmpty(phoneNo)) {
        smsButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MemberActions.sendSmsTo(phoneNo, MemberInfoFragment.this);
            }
        });
        callButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MemberActions.makeCallTo(phoneNo, MemberInfoFragment.this);
            }
        });

        smsButton.setEnabled(true);
        callButton.setEnabled(true);
    } else {
        smsButton.setEnabled(false);
        callButton.setEnabled(false);
    }

    setTextWithPrefixIfNotEmpty(view, R.id.member_flags, R.string.member_info,
            args.getString(Member.Keys.FLAGS));
    setTextWithPrefixIfNotEmpty(view, R.id.member_prao, R.string.member_prao,
            args.getString(Member.Keys.DATE_PRAO));
    setTextWithPrefixIfNotEmpty(view, R.id.member_marskalk, R.string.member_marskalk,
            args.getString(Member.Keys.DATE_MARSKALK));
    setTextWithPrefixIfNotEmpty(view, R.id.member_vraq, R.string.member_vraq,
            args.getString(Member.Keys.DATE_VRAQ));

    int experiencePoints = args.getInt(Member.Keys.EXPERIENCE_POINTS);
    TextView experienceText = (TextView) view.findViewById(R.id.member_experience);
    if (experiencePoints >= EXPERIENCE_MIN) {
        setTextWithPrefix(experienceText, R.string.member_exp,
                String.format(getString(R.string.member_points_format), experiencePoints));
        experienceText.setVisibility(View.VISIBLE);
    } else {
        experienceText.setVisibility(View.GONE);
    }

    List<MemberBadge> experienceBadges = args.getParcelableArrayList(Member.Keys.EXPERIENCE_BADGES);
    LinearLayout badgesLayout = (LinearLayout) view.findViewById(R.id.member_badges);
    if (null != experienceBadges && !experienceBadges.isEmpty()) {
        initializeListOfBadges(badgesLayout, experienceBadges);
    } else {
        badgesLayout.setVisibility(View.GONE);
    }

    return view;
}

From source file:com.open.file.manager.MainActivity.java

/**
 * If an operation was not completed, restart it
 * //from  w w w  . j ava2s  . c om
 * @param savedInstanceState
 */
private boolean restoreOperations(Bundle savedInstanceState) {
    boolean restoreconflicts = false;
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey("conflicts")) {
            Log.d("reload", "conflicts");
            FileOperations.conflicts = savedInstanceState.getParcelableArrayList("conflicts");
            restoreconflicts = !FileOperations.conflicts.isEmpty();
        }
        FileOperations.currentaction = savedInstanceState.getInt("operation");
        if (savedInstanceState.containsKey("oldqueue")) {
            List<String> filequeue = savedInstanceState.getStringArrayList("oldqueue");
            for (String curfile : filequeue) {
                FileOperations.operationqueue.add(new File(curfile));
            }
        }
        if (savedInstanceState.containsKey("currentpath")) {
            FileOperations.currentpath = savedInstanceState.getString("currentpath");
        }
        operator.restoreOp();
    }
    return restoreconflicts;
}

From source file:org.connectbot.HostEditorFragment.java

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

    Bundle bundle = savedInstanceState == null ? getArguments() : savedInstanceState;

    Parcelable existingHostParcelable = bundle.getParcelable(ARG_EXISTING_HOST);
    if (existingHostParcelable != null) {
        mHost = HostBean.fromContentValues((ContentValues) existingHostParcelable);
        mHost.setId(bundle.getLong(ARG_EXISTING_HOST_ID));
    } else {//from  w w  w .j av  a 2s .c  o m
        mHost = new HostBean();
    }

    mPubkeyNames = bundle.getStringArrayList(ARG_PUBKEY_NAMES);
    mPubkeyValues = bundle.getStringArrayList(ARG_PUBKEY_VALUES);

    mIsUriEditorExpanded = bundle.getBoolean(ARG_IS_EXPANDED);
}

From source file:com.RSMSA.policeApp.OffenceReportForm.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REPORT_RESULT) {
        if (resultCode == RESULT_OK) {
            // code for result
            final Bundle bundle = data.getExtras();

            Log.d("Database", "count at parent is " + count);
            desc = bundle.getStringArrayList("desc");
            type = bundle.getStringArrayList("type");
            uids = bundle.getStringArrayList("uids");
            OffenseListActivity.offenseDesc.clear();
            backFromChild = true;//w  ww .j a v  a  2  s . c o  m

            Log.d(TAG, "number of ids = " + uids.size());

            try {
                Log.d(TAG, " test data = " + invalidLicence);
            } catch (Exception e) {
            }
            if (invalidLicence != null && !invalidLicence.equals("")) {
                String offenceUid = invalidLicence;
                boolean offenceIncluded = false;
                for (String i : uids) {
                    if (offenceUid.equals(i)) {
                        offenceIncluded = true;
                    }
                }

                if (!offenceIncluded) {
                    Log.d(TAG, " desc sze before = " + desc.size());
                    IroadDatabase db = new IroadDatabase(getApplicationContext());
                    int counter = uids.size();
                    uids.add(offenceUid);
                    desc.add(db.getAnOffenceDetail(false, offenceUid));
                    type.add(db.getAnOffenceDetail(true, offenceUid));
                }

            }

            //TODO implement the above for expired licence

            count = desc.size();
            int counter = desc.size();
            if (counter > 0) {
                offencesSelectedTextView.setVisibility(View.VISIBLE);
                submit_layout1.setVisibility(View.VISIBLE);
            } else {
                offencesSelectedTextView.setVisibility(View.GONE);
                submit_layout1.setVisibility(View.GONE);
            }
            offencesSelected = "";
            for (int i = 0; i < counter; i++) {
                if (i == counter - 1) {
                    offencesSelected = offencesSelected + desc.get(i);
                    offenceList = offenceList + desc.get(i);
                } else {
                    offencesSelected = offencesSelected + desc.get(i) + "\n\n";
                    offenceList = offenceList + desc.get(i) + ",";
                }
            }
            offencesSelectedTextView.setText(offencesSelected);
            offensesCommittedTextview.setText(offencesSelected);
            amountToReport = 0;
            for (int i = 0; i < count; i++) {
                Log.d(TAG, "type = " + type.get(i));
                try {
                    amountToReport += Integer.parseInt(type.get(i));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            Log.d(TAG, "amount to report = " + amountToReport);

            TextView offenceCost = (TextView) findViewById(R.id.costs);
            offenceCost.setTypeface(MainOffence.Roboto_Regular);
            offenceCost.setText(amountToReport + "");

        }
        if (resultCode == RESULT_CANCELED) {
        }
    }
}

From source file:com.artemchep.horario.ui.fragments.master.LessonsFragment.java

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

    mEmptyView = view.findViewById(R.id.empty);
    mWeekView = (WeekView) view.findViewById(R.id.week_view);
    mWeekView.setMultiSelectEnabled(mEditable);
    mWeekView.getFilterManager().registerListener(mObserver);

    if (savedInstanceState != null) {
        // Restore current selections; note: do it before registering
        // event listener -- all other components should have restored
        // their states.
        ArrayList<String> selections = savedInstanceState.getStringArrayList(SIS_SELECTIONS);
        if (selections != null)
            for (String key : selections) {
                mWeekView.getMultiSelector().add(key);
            }/*w w w. ja  va2 s .c om*/
    }

    mWeekView.setSubjects(mWatcherSubjects.getMap());
    mWeekView.setTeachers(mWatcherTeachers.getMap());
    mWeekView.setFilter(new Filter<Lesson>() {
        @Override
        public boolean isValid(@NonNull Lesson model) {
            return !mHiddenSet.contains(model.key);
        }
    });
    mWeekView.getMultiSelector().registerListener(this);
    mWeekView.setOnLessonClickListener(new WeekView.OnLessonClickListener() {
        @Override
        public void onLessonClick(@NonNull View view, @NonNull Lesson lesson) {
            Bundle args = new Bundle();
            args.putString(ModelFragment.EXTRA_TIMETABLE_PATH, mTimetablePath);
            args.putParcelable(MooDetailsFragment.EXTRA_MODEL, lesson);
            Fragment fragment = new LessonDetailsFragment();
            fragment.setArguments(args);

            MainActivity activity = (MainActivity) getActivity();
            activity.navigateDetailsFrame(fragment);
        }
    });
}

From source file:com.andersson.minesweeper.util.IabHelper.java

public String getPricesDev() throws RemoteException, JSONException {

    ArrayList<String> skuList = new ArrayList<String>();
    Collections.addAll(skuList, SkuDetails.SKU_LIST);

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList("ITEM_ID_LIST", skuList);

    Bundle skuDetails = mService.getSkuDetails(3, mPackageName, "inapp", querySkus);

    int response = skuDetails.getInt("RESPONSE_CODE");
    if (response == 0) {
        ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");

        for (String thisResponse : responseList) {
            JSONObject object = new JSONObject(thisResponse);
            String sku = object.getString("productId");
            String price = object.getString("price");
            logError(thisResponse);//www  .  java  2  s.c  o  m

        }
    }
    return "Not found";

}

From source file:me.piebridge.prevent.framework.SystemReceiver.java

private void handleConfiguration(Bundle bundle) {
    setForceStopTimeout(bundle.getLong(PreventIntent.KEY_FORCE_STOP_TIMEOUT));
    SystemHook.setDestroyProcesses(bundle.getBoolean(PreventIntent.KEY_DESTROY_PROCESSES));
    SystemHook.setLockSyncSettings(bundle.getBoolean(PreventIntent.KEY_LOCK_SYNC_SETTINGS));
    SystemHook.setUseAppStandby(bundle.getBoolean(PreventIntent.KEY_USE_APP_STANDBY));
    setAutoPrevent(bundle.getBoolean(PreventIntent.KEY_AUTO_PREVENT, true));
    if (bundle.containsKey(PreventIntent.KEY_STOP_SIGNATURE_APPS)) {
        // this is not an option can set from ui
        SystemHook.setStopSignatureApps(bundle.getBoolean(PreventIntent.KEY_STOP_SIGNATURE_APPS, true));
    }/*from  www  . j a va 2  s .  com*/
    if (bundle.containsKey(PreventIntent.KEY_PREVENT_LIST)) {
        updatePreventList(bundle.getStringArrayList(PreventIntent.KEY_PREVENT_LIST));
    }
    saveConfiguration(new Configuration(bundle), true);
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.general_info_drug);
    isStoredInLocal = false;//from   w w  w . j  a va2s.co  m
    fiveLastScreen = false;
    helper = new Handler_Sqlite(this);
    helper.open();
    Bundle extras1 = this.getIntent().getExtras();
    if (extras1 != null) {
        infoBundle = extras1.getStringArrayList("generalInfoDrug");
        fiveLastScreen = extras1.getBoolean("fiveLastScreen");
        if (infoBundle == null)
            isStoredInLocal = true;
        if (!isStoredInLocal) {
            initializeGeneralInfoDrug();
            initializeCodesInformation();
            initializeCodes();
        } else {
            drug_name = extras1.getString("drugName");
            codes = helper.getCodes(drug_name);
            codesInformation = helper.getCodesInformation(drug_name);
        }
        //Title
        TextView drugTitle = (TextView) findViewById(R.id.drugTitle);
        drugTitle.setText(drug_name);
        drugTitle.setTypeface(Typeface.SANS_SERIF);

        //Description 
        LinearLayout borderDescription = new LinearLayout(this);
        borderDescription.setOrientation(LinearLayout.VERTICAL);
        borderDescription
                .setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        borderDescription.setBackgroundResource(R.drawable.layout_border);

        TextView description = new TextView(this);
        if (isStoredInLocal)
            description.setText(helper.getDescription(drug_name));
        else
            description.setText(this.description);
        description.setTextSize(18);
        description.setTypeface(Typeface.SANS_SERIF);

        LinearLayout.LayoutParams paramsDescription = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        paramsDescription.leftMargin = 60;
        paramsDescription.rightMargin = 60;
        paramsDescription.topMargin = 20;

        borderDescription.addView(description, borderDescription.getChildCount(), paramsDescription);

        LinearLayout layoutDescription = (LinearLayout) findViewById(R.id.layoutDescription);
        layoutDescription.addView(borderDescription, layoutDescription.getChildCount());

        //Animals
        TextView headerAnimals = (TextView) findViewById(R.id.headerAnimals);
        headerAnimals.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);

        Button cetaceansButton = (Button) findViewById(R.id.cetaceansButton);
        cetaceansButton.setText("CETACEANS");
        cetaceansButton.setTypeface(Typeface.SANS_SERIF);
        cetaceansButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                showDoseInformation(drug_name, "Cetaceans");
            }
        });

        Button pinnipedsButton = (Button) findViewById(R.id.pinnipedsButton);
        pinnipedsButton.setText("PINNIPEDS");
        pinnipedsButton.setTypeface(Typeface.SANS_SERIF);
        pinnipedsButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                SQLiteDatabase db = helper.open();
                ArrayList<String> families = new ArrayList<String>();
                if (db != null)
                    families = helper.read_animals_family(drug_name, "Pinnipeds");
                if ((families != null && families.size() == 1 && families.get(0).equals(""))
                        || (families != null && families.size() == 0))
                    showDoseInformation(drug_name, "Pinnipeds");
                else
                    showDoseInformationPinnipeds(drug_name, families);
            }
        });

        Button otherButton = (Button) findViewById(R.id.otherButton);
        otherButton.setText("OTHER MM");
        otherButton.setTypeface(Typeface.SANS_SERIF);
        otherButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                showDoseInformation(drug_name, "Other MM");
            }
        });

        //Codes & therapeutic target & anatomical target
        TextView headerATCvetCodes = (TextView) findViewById(R.id.headerATCvetCodes);
        headerATCvetCodes.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);

        //Action
        TextView headerActionAnatomical = (TextView) findViewById(R.id.headerActionAnatomical);
        headerActionAnatomical.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);

        createTextViewAnatomical();
        createBorderAnatomicalGroup();

        TextView headerActionTherapeutic = (TextView) findViewById(R.id.headerActionTherapeutic);
        headerActionTherapeutic.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);

        createTextViewTherapeutic();
        createBorderTherapeuticGroup();

        params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        params.leftMargin = 60;
        params.rightMargin = 60;
        params.topMargin = 20;

        Spinner codesSpinner = (Spinner) findViewById(R.id.codesSpinner);
        SpinnerAdapter adapterCodes = new SpinnerAdapter(this, R.layout.item_spinner, codes);
        adapterCodes.setDropDownViewResource(R.layout.spinner_dropdown_item);
        codesSpinner.setAdapter(adapterCodes);
        codesSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            public void onItemSelected(AdapterView<?> parent, View arg1, int arg2, long arg3) {
                userEntryCode = parent.getSelectedItem().toString();
                int numCodes = codesInformation.size();

                layoutAnatomicalGroup.removeView(borderAnatomicalGroup);
                createBorderAnatomicalGroup();

                boolean founded = false;
                int i = 0;
                while (!founded && i < numCodes) {
                    if (userEntryCode.equals(codesInformation.get(i).getCode())) {
                        createTextViewAnatomical();
                        anatomicalGroup.setText(codesInformation.get(i).getAnatomic_group() + "\n");
                        borderAnatomicalGroup.addView(anatomicalGroup, borderAnatomicalGroup.getChildCount(),
                                params);
                        founded = true;
                    }
                    i++;
                }

                layoutAnatomicalGroup = (LinearLayout) findViewById(R.id.layoutActionAnatomical);
                layoutAnatomicalGroup.addView(borderAnatomicalGroup, layoutAnatomicalGroup.getChildCount());
                layoutTherapeuticGroup.removeView(borderTherapeuticGroup);
                createBorderTherapeuticGroup();
                founded = false;
                i = 0;
                while (!founded && i < numCodes) {
                    if (userEntryCode.equals(codesInformation.get(i).getCode())) {
                        createTextViewTherapeutic();
                        therapeuticGroup.setText(codesInformation.get(i).getTherapeutic_group() + "\n");
                        borderTherapeuticGroup.addView(therapeuticGroup, borderTherapeuticGroup.getChildCount(),
                                params);
                        founded = true;
                    }
                    i++;
                }
                layoutTherapeuticGroup = (LinearLayout) findViewById(R.id.layoutActionTherapeutic);
                layoutTherapeuticGroup.addView(borderTherapeuticGroup, layoutTherapeuticGroup.getChildCount());
            }

            public void onNothingSelected(AdapterView<?> arg0) {
            }
        });

        layoutAnatomicalGroup = (LinearLayout) findViewById(R.id.layoutActionAnatomical);
        layoutTherapeuticGroup = (LinearLayout) findViewById(R.id.layoutActionTherapeutic);

        borderTherapeuticGroup.addView(therapeuticGroup, borderTherapeuticGroup.getChildCount(), params);
        borderAnatomicalGroup.addView(anatomicalGroup, borderAnatomicalGroup.getChildCount(), params);

        layoutAnatomicalGroup.addView(borderAnatomicalGroup, layoutAnatomicalGroup.getChildCount());
        layoutTherapeuticGroup.addView(borderTherapeuticGroup, layoutTherapeuticGroup.getChildCount());

        //Generic Drug
        TextView headerGenericDrug = (TextView) findViewById(R.id.headerGenericDrug);
        headerGenericDrug.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
        boolean isAvalaible = false;
        if (isStoredInLocal)
            isAvalaible = helper.isAvalaible(drug_name);
        else
            isAvalaible = available.equals("Yes");
        if (isAvalaible) {
            ImageView genericDrug = new ImageView(this);
            genericDrug.setImageResource(R.drawable.tick_verde);
            LinearLayout layoutGenericDrug = (LinearLayout) findViewById(R.id.layoutGenericDrug);
            layoutGenericDrug.addView(genericDrug);
        } else {
            Typeface font = Typeface.createFromAsset(getAssets(), "Typoster_demo.otf");
            TextView genericDrug = new TextView(this);
            genericDrug.setTypeface(font);
            genericDrug.setText("Nd");
            genericDrug.setTextColor(getResources().getColor(R.color.maroon));
            genericDrug.setTextSize(20);
            DisplayMetrics metrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(metrics);
            int size = metrics.widthPixels;
            int middle = size / 2;
            int quarter = size / 4;
            genericDrug.setTranslationX(middle - quarter);
            genericDrug.setTranslationY(-3);
            LinearLayout layoutGenericDrug = (LinearLayout) findViewById(R.id.layoutGenericDrug);
            layoutGenericDrug.addView(genericDrug);
        }

        //Licenses
        TextView headerLicense = (TextView) findViewById(R.id.headerLicense);
        headerLicense.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);

        TextView fdaLicense = (TextView) findViewById(R.id.license1);
        Typeface font = Typeface.createFromAsset(getAssets(), "Typoster_demo.otf");
        fdaLicense.setTypeface(font);

        String fda;
        if (isStoredInLocal)
            fda = helper.getLicense_FDA(drug_name);
        else
            fda = license_FDA;
        if (fda.equals("Yes")) {
            fdaLicense.setText("Yes");
            fdaLicense.setTextColor(getResources().getColor(R.color.lightGreen));
        } else {
            fdaLicense.setText("Nd");
            fdaLicense.setTextColor(getResources().getColor(R.color.maroon));
        }

        TextView emaLicense = (TextView) findViewById(R.id.license3);
        emaLicense.setTypeface(font);
        String ema;
        if (isStoredInLocal)
            ema = helper.getLicense_EMA(drug_name);
        else
            ema = license_EMA;
        if (ema.equals("Yes")) {
            emaLicense.setText("Yes");
            emaLicense.setTextColor(getResources().getColor(R.color.lightGreen));
        } else {
            emaLicense.setText("Nd");
            emaLicense.setTextColor(getResources().getColor(R.color.maroon));
        }

        TextView aempsLicense = (TextView) findViewById(R.id.license2);
        aempsLicense.setTypeface(font);
        String aemps;
        if (isStoredInLocal)
            aemps = helper.getLicense_AEMPS(drug_name);
        else
            aemps = license_AEMPS;
        if (aemps.equals("Yes")) {
            aempsLicense.setText("Yes");
            aempsLicense.setTextColor(getResources().getColor(R.color.lightGreen));
        } else {
            aempsLicense.setText("Nd");
            aempsLicense.setTextColor(getResources().getColor(R.color.maroon));
        }

        ImageButton food_and_drug = (ImageButton) findViewById(R.id.food_and_drug);
        food_and_drug.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(
                        "http://www.fda.gov/animalveterinary/products/approvedanimaldrugproducts/default.htm"));
                startActivity(intent);
            }
        });

        ImageButton european_medicines_agency = (ImageButton) findViewById(R.id.european_medicines_agency);
        european_medicines_agency.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(
                        "http://www.ema.europa.eu/ema/index.jsp?curl=pages/medicines/landing/vet_epar_search.jsp&mid=WC0b01ac058001fa1c"));
                startActivity(intent);
            }
        });

        ImageButton logo_aemps = (ImageButton) findViewById(R.id.logo_aemps);
        logo_aemps.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(
                        "http://www.aemps.gob.es/medicamentosVeterinarios/Med-Vet-autorizados/home.htm"));
                startActivity(intent);
            }

        });

        if (helper.existDrug(drug_name)) {
            int drug_priority = helper.getDrugPriority(drug_name);
            ArrayList<String> sorted_drugs = new ArrayList<String>();
            sorted_drugs.add(0, drug_name);
            for (int i = 1; i < drug_priority; i++) {
                String name = helper.getDrugName(i);
                sorted_drugs.add(i, name);
            }

            for (int i = 0; i < sorted_drugs.size(); i++)
                helper.setDrugPriority(sorted_drugs.get(i), i + 1);
        }

        if (!isStoredInLocal) {
            //Server code
            String[] urls = { "http://formmulary.tk/Android/getDoseInformation.php?drug_name=",
                    "http://formmulary.tk/Android/getGeneralNotesInformation.php?drug_name=" };
            new GetDoseInformation(this).execute(urls);
        }

        helper.close();
    }

}

From source file:com.krayzk9s.imgurholo.ui.ImagesFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);/*  ww w . j  a  v a  2s  . c om*/
    ImgurHoloActivity activity = (ImgurHoloActivity) getActivity();
    actionBar = activity.getActionBar();
    SharedPreferences settings = activity.getApiCall().settings;
    Bundle bundle = getArguments();
    if (savedInstanceState != null) {
        urls = savedInstanceState.getStringArrayList("urls");
        ids = savedInstanceState.getParcelableArrayList("ids");
        page = savedInstanceState.getInt("page");
    } else {
        urls = new ArrayList<String>();
        ids = new ArrayList<JSONParcelable>();
        page = 0;
    }
    if (bundle != null && bundle.containsKey("id"))
        isGridView = settings.getString("GalleryLayout", getString(R.string.card_view))
                .equals(getString(R.string.grid_view));
    else {
        isGridView = settings.getString("ImagesLayout", getString(R.string.grid_view))
                .equals(getString(R.string.grid_view));
    }
    if (bundle == null) {
        return;
    }
    if (bundle.containsKey("id"))
        albumId = bundle.getString("id");
    else
        albumId = null;
    if (bundle.containsKey("imageCall"))
        imageCall = bundle.getString("imageCall");
    if (bundle.containsKey("albumData")) {
        JSONParcelable dataParcel = bundle.getParcelable("albumData");
        if (dataParcel != null)
            galleryAlbumData = dataParcel.getJSONObject();
    }
}

From source file:com.cwp.cmoneycharge.activity.AddPayActivity.java

@Override
public void onPartialResults(Bundle partialResults) {
    //?/*from w  w  w. j  a  v a2s .  co m*/
    ArrayList<String> nbest = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    if (nbest.size() > 0) {
        Toast.makeText(AddPayActivity.this,
                "~" + Arrays.toString(nbest.toArray(new String[0])), Toast.LENGTH_SHORT)
                .show();
        //Toast.makeText().setText(nbest.get(0));
    }
}