Example usage for android.os Bundle getStringArray

List of usage examples for android.os Bundle getStringArray

Introduction

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

Prototype

@Nullable
public String[] getStringArray(@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:com.loloof64.android.chess_position_manager.file_explorer.ConfirmRemoveElementsDialogFragment.java

@NonNull
@Override//from   www .ja v a  2  s. co  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    final View view = inflater.inflate(R.layout.remove_elements_confirm_dialog_layout, null);

    TextView foldersView = (TextView) view.findViewById(R.id.removing_elements_folders_list);
    TextView positionsView = (TextView) view.findViewById(R.id.removing_elements_positions_list);

    String[] tempFolders = new String[0];
    String[] tempPositions = new String[0];

    Bundle arguments = getArguments();
    if (arguments != null) {
        tempFolders = arguments.getStringArray(FOLDERS_TAG);
        tempPositions = arguments.getStringArray(POSITIONS_TAG);
    }

    Arrays.sort(tempFolders);
    Arrays.sort(tempPositions);

    final String[] folders = tempFolders;
    final String[] positions = tempPositions;

    StringBuilder foldersTxtBuilder = new StringBuilder();
    StringBuilder positionsTxtBuilder = new StringBuilder();

    for (String currentFolder : folders) {
        foldersTxtBuilder.append(String.format("-) %s\n", currentFolder));
    }

    for (String currentPosition : positions) {
        positionsTxtBuilder.append(String.format("-) %s\n", currentPosition));
    }

    foldersView.setText(folders.length > 0 ? foldersTxtBuilder : getString(R.string.none));
    positionsView.setText(positions.length > 0 ? positionsTxtBuilder : getString(R.string.none));

    builder.setTitle(R.string.title_removing_elements).setView(view)
            .setPositiveButton(R.string.action_validate, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    listener.onConfirmRemoveElementsDialogPositiveClick(folders, positions);
                }
            }).setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    ConfirmRemoveElementsDialogFragment.this.getDialog().cancel();
                }
            });

    return builder.create();
}

From source file:com.wenyu.kaijiw.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photo_image_pager);

    Bundle bundle = getIntent().getExtras();
    String[] imageUrls = bundle.getStringArray(Extra.IMAGES);
    // View/* w w w  .  j av a 2  s .c  o  m*/
    int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0);

    // 
    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .cacheInMemory(true).imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition); // View
}

From source file:org.deviceconnect.android.deviceplugin.hvcc2w.setting.fragment.HVCC2WPairingFragment.java

/** Check Permission. */
private void checkPermission() {
    // WiFi scan requires location permissions.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP + 1) {
        if (PermissionChecker.checkSelfPermission(getContext(),
                Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED
                && PermissionChecker.checkSelfPermission(getContext(),
                        Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
            searchWifi();/*ww w. j  av  a2 s. c om*/
        } else {
            PermissionRequestActivity.requestPermissions(getContext(),
                    new String[] { Manifest.permission.ACCESS_COARSE_LOCATION,
                            Manifest.permission.ACCESS_FINE_LOCATION },
                    new ResultReceiver(new Handler(Looper.getMainLooper())) {
                        @Override
                        protected void onReceiveResult(final int resultCode, final Bundle resultData) {
                            String[] retPermissions = resultData.getStringArray("EXTRA_PERMISSIONS");
                            int[] retGrantResults = resultData.getIntArray("EXTRA_GRANT_RESULTS");
                            if (retPermissions == null || retGrantResults == null) {
                                HVCC2WDialogFragment.showAlert(getActivity(), getString(R.string.hw_name),
                                        "WiFi scan aborted.", null);
                                return;
                            }
                            for (int i = 0; i < retPermissions.length; ++i) {
                                if (retGrantResults[i] == PackageManager.PERMISSION_DENIED) {
                                    HVCC2WDialogFragment.showAlert(getActivity(), getString(R.string.hw_name),
                                            "WiFi scan aborted.", null);
                                    return;
                                }
                            }
                            searchWifi();
                        }
                    });
        }
    }
}

From source file:com.cwc.litenote.GalleryPagerAct.java

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

    getActionBar().hide();/*from www.  j a  va2s. co  m*/
    setContentView(R.layout.picture_pager);

    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    String[] imageUrls = bundle.getStringArray(IMAGES);
    int pagerPosition = bundle.getInt(IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    UilCommon.init();

    pager = (ViewPager) findViewById(R.id.imagePager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:io.kult.teatruindependent.app.ImagePagerActivity.java

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

    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    String[] imageUrls = bundle.getStringArray("IMAGES");
    int pagerPosition = bundle.getInt("IMAGE_POSITION", 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }/*from   w  w w . j  a v  a 2 s .c o  m*/

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.nostra13.example.universalimageloader.ImagePagerActivity.java

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

    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    String[] imageUrls = bundle.getStringArray(Extra.IMAGES);
    int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }/*from  www  . j  av a 2  s  . c om*/

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisk(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.ririn.imageloader.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_pager);

    Bundle bundle = getIntent().getExtras();
    String[] judul = bundle.getStringArray(Extra.TAG_JUDUL);
    String[] intro = bundle.getStringArray(Extra.TAG_INTRO);
    String[] bahan = bundle.getStringArray(Extra.TAG_BAHAN);
    String[] penyajian = bundle.getStringArray(Extra.TAG_PENYAJIAN);
    String[] gambar = bundle.getStringArray(Extra.TAG_GAMBAR);
    int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }//from  www.  j  a v a  2 s  .c  o  m

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(300)).build();
    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(gambar, judul, intro, bahan, penyajian));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.kenny.Image.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_pager);

    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    String[] imageUrls = bundle.getStringArray(Extra.IMAGES);
    int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }//from  ww  w.  ja v  a2s. c  om

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.simple.wildfishingnote.common.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_pager);

    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    String[] imageUrls = bundle.getStringArray(IMAGE_NAMES);
    int pagerPosition = 0;

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }//from   w  w w .  jav  a  2 s. c  o m

    imageLoader.init(ImageLoaderConfiguration.createDefault(this));
    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.cw.litenote.media.image.GalleryPagerAct.java

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

    getActionBar().hide();/*from  w w w .j  ava2s . co m*/
    setContentView(R.layout.gallery_pager);

    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    String[] imageUrls = bundle.getStringArray(IMAGES);
    int pagerPosition = bundle.getInt(IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    UilCommon.init();

    pager = (ViewPager) findViewById(R.id.imagePager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}