Example usage for android.content Intent putStringArrayListExtra

List of usage examples for android.content Intent putStringArrayListExtra

Introduction

In this page you can find the example usage for android.content Intent putStringArrayListExtra.

Prototype

public @NonNull Intent putStringArrayListExtra(String name, ArrayList<String> value) 

Source Link

Document

Add extended data to the intent.

Usage

From source file:com.antew.redditinpictures.library.reddit.SubredditsSearchResponse.java

@Override
public void processHttpResponse(Context context) {
    Ln.d("Subreddit Search complete! = %s", result.getJson());
    SubredditsSearch subredditsSearch = JsonDeserializer.deserialize(result.getJson(), SubredditsSearch.class);

    if (subredditsSearch == null) {
        Ln.e("Something went wrong on Subreddit Search status code: %d json: %s", result.getHttpStatusCode(),
                result.getJson());//  ww w.j a v  a  2 s  .c  o  m
        return;
    }

    Intent intent = new Intent(Constants.Broadcast.BROADCAST_SUBREDDIT_SEARCH);
    intent.putStringArrayListExtra(Constants.Extra.EXTRA_SUBREDDIT_NAMES,
            (ArrayList<String>) subredditsSearch.getNames());
    LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}

From source file:com.kaliturin.blacklist.fragments.GetContactsFragment.java

@Override
protected void addContacts(List<Contact> contacts, LongSparseArray<ContactNumber> singleContactNumbers) {
    // prepare returning arguments - data of the chosen contacts
    ArrayList<String> names = new ArrayList<>();
    ArrayList<String> numbers = new ArrayList<>();
    ArrayList<Integer> types = new ArrayList<>();
    for (Contact contact : contacts) {
        ContactNumber contactNumber = singleContactNumbers.get(contact.id);
        if (contactNumber != null) {
            // add single number of the contact
            names.add(contact.name);//from  w  w  w .  j a  v  a  2 s .  co  m
            numbers.add(contactNumber.number);
            types.add(contactNumber.type);
        } else {
            // all numbers of the contact
            for (ContactNumber _contactNumber : contact.numbers) {
                names.add(contact.name);
                numbers.add(_contactNumber.number);
                types.add(_contactNumber.type);
            }
        }
    }

    // return arguments
    Intent intent = new Intent();
    intent.putStringArrayListExtra(CONTACT_NAMES, names);
    intent.putStringArrayListExtra(CONTACT_NUMBERS, numbers);
    intent.putIntegerArrayListExtra(CONTACT_NUMBER_TYPES, types);
    getActivity().setResult(Activity.RESULT_OK, intent);
    getActivity().finish();
}

From source file:fr.bmartel.android.tictactoe.gcm.MyGcmListenerService.java

public void broadcastUpdateStringList(String action, ArrayList<String> valueList) {

    String valueName = "";
    final Intent intent = new Intent(action);
    intent.putStringArrayListExtra(valueName, valueList);
    Log.i(TAG, "broadcast message");
    sendBroadcast(intent);/*from ww w .  j av a2  s  . c o  m*/
}

From source file:com.qiscus.sdk.filepicker.FilePickerActivity.java

private void returnData(ArrayList<String> paths) {
    Intent intent = new Intent();
    intent.putStringArrayListExtra(type == FilePickerConst.MEDIA_PICKER ? FilePickerConst.KEY_SELECTED_MEDIA
            : FilePickerConst.KEY_SELECTED_DOCS, paths);
    setResult(RESULT_OK, intent);/*from  w w w  . j  a v a  2 s .c om*/
    finish();
}

From source file:com.github.secondsun.catfactsdemo.networking.CatFactFetcherService.java

private void sendData() {
    Intent resultIntent = new Intent(FILTER_KEY);
    resultIntent.putStringArrayListExtra(FACTS, data);
    sendBroadcast(resultIntent);/*from www . j a v  a 2  s .co  m*/
}

From source file:cm.aptoidetv.pt.ViewPagerAdapterScreenshots.java

@Override
public Object instantiateItem(ViewGroup container, final int position) {

    final View v = LayoutInflater.from(context).inflate(R.layout.row_item_screenshots_big, null);
    final ProgressBar pb = (ProgressBar) v.findViewById(R.id.screenshots_loading_big);

    String icon;/*from   www .  j av  a2 s .  com*/
    if (hd) {
        Log.d("Aptoide-Screenshots", "Icon is hd: " + url.get(position));

        if (url.get(position).contains("_screen")) {
            icon = url.get(position).split("\\|")[1];
            Log.d("Aptoide-Screenshots", "Icon is : " + icon);
        } else {
            icon = url.get(position);
        }

    } else {
        icon = screenshotToThumb(url.get(position));
    }

    Picasso.with(context).load(icon).error(R.drawable.icon_non_available)
            .into((ImageView) v.findViewById(R.id.screenshot_image_big));

    container.addView(v);
    if (!hd) {
        v.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                Intent i = new Intent(context, ScreenshotsViewer.class);
                i.putStringArrayListExtra("url", url);
                i.putExtra("position", position);
                context.startActivity(i);
            }
        });
    }
    return v;

}

From source file:org.creativecommons.thelist.activities.GalleryActivity.java

@Override
public void viewImage(ArrayList<String> urls, int position) {
    Intent intent = new Intent(GalleryActivity.this, ImageActivity.class);
    intent.putExtra("position", position);
    intent.putStringArrayListExtra("urls", urls);
    startActivity(intent);//from   w  w w  . j  a  va 2s  .  co  m
}

From source file:cm.aptoide.pt.adapters.ViewPagerAdapterScreenshots.java

@Override
public Object instantiateItem(ViewGroup container, final int position) {

    final View v = LayoutInflater.from(context).inflate(R.layout.row_item_screenshots_big, null);
    final ProgressBar pb = (ProgressBar) v.findViewById(R.id.screenshots_loading_big);

    imageLoader.displayImage(hd ? url.get(position) : screenshotToThumb(url.get(position)),
            (ImageView) v.findViewById(R.id.screenshot_image_big), options, new ImageLoadingListener() {

                @Override/*  w  w  w . ja v a2 s  .  c o  m*/
                public void onLoadingStarted(String uri, View view) {
                    pb.setVisibility(View.VISIBLE);
                }

                @Override
                public void onLoadingFailed(String uri, View v, FailReason failReason) {
                    ((ImageView) v.findViewById(R.id.screenshot_image_big))
                            .setImageResource(android.R.drawable.ic_delete);
                    pb.setVisibility(View.GONE);
                }

                @Override
                public void onLoadingComplete(String uri, View v, Bitmap loadedImage) {
                    pb.setVisibility(View.GONE);
                }

                @Override
                public void onLoadingCancelled(String uri, View v) {
                }
            });
    container.addView(v);
    if (!hd) {
        v.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                Intent i = new Intent(context, ScreenshotsViewer.class);
                i.putStringArrayListExtra("url", url);
                i.putExtra("position", position);
                i.putExtra("hashCode", hashCode + ".hd");
                context.startActivity(i);
            }
        });
    }
    return v;

}

From source file:com.nextome.geojsonviewer.MainActivity.java

public void openMap(Class<?> activity) {
    if (fileUris != null) {
        Intent mapsIntent = new Intent(this, activity);
        mapsIntent.putStringArrayListExtra(GeoJsonViewerConstants.INTENT_EXTRA_JSON_URI, fileUris);
        mapsIntent.putIntegerArrayListExtra(GeoJsonViewerConstants.INTENT_EXTRA_JSON_COLORS, layerColors);
        startActivity(mapsIntent);//from   w ww  .  j  a  v  a 2 s. com
    } else {
        Toast.makeText(getApplicationContext(), R.string.geojson_opener_unable_to_read, Toast.LENGTH_LONG)
                .show();
        finish();
    }
}

From source file:com.adkdevelopment.earthquakesurvival.ui.geofence.GeofenceService.java

/**
 * Sends a notification to the phone/* ww w .  ja v a2  s.  co  m*/
 * @param notificationDetails String with details to show in the notification
 */
private void sendNotification(List<String> notificationDetails) {

    Context context = getBaseContext();

    // Create an explicit content Intent that starts the main Activity.
    Intent notificationIntent = new Intent(context, DetailActivity.class);
    notificationIntent.putStringArrayListExtra(Feature.GEOFENCE, (ArrayList<String>) notificationDetails);

    // Construct a task stack.
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);

    // Add the main Activity to the task stack as the parent.
    stackBuilder.addParentStack(PagerActivity.class);

    // Push the content Intent onto the stack.
    stackBuilder.addNextIntent(notificationIntent);

    // Get a PendingIntent containing the entire back stack.
    PendingIntent notificationPendingIntent = stackBuilder.getPendingIntent(0,
            PendingIntent.FLAG_UPDATE_CURRENT);

    // Get a notification builder that's compatible with platform versions >= 4
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);

    Bitmap largeIcon = null;
    try {
        largeIcon = Picasso.with(context).load(R.mipmap.ic_launcher).get();
    } catch (IOException e) {
        Log.e(TAG, "e:" + e);
    }

    // Define the notification settings.
    builder.setAutoCancel(true).setSmallIcon(R.mipmap.ic_launcher).setDefaults(Notification.DEFAULT_ALL)
            .setLargeIcon(largeIcon).setColor(Color.RED).setTicker(getString(R.string.geofence_notification))
            .setContentTitle(getString(R.string.app_name))
            .setContentText(getString(R.string.geofence_notification_text))
            .setContentIntent(notificationPendingIntent)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(
                    notificationDetails.get(0) + "\n" + getString(R.string.geofence_notification_text)))
            .setGroup(EarthquakeObject.NOTIFICATION_GROUP);

    // Get an instance of the Notification manager
    NotificationManagerCompat mNotificationManager = NotificationManagerCompat.from(context);

    // Issue the notification
    mNotificationManager.notify(EarthquakeObject.NOTIFICATION_ID_1, builder.build());
}