Example usage for android.os Bundle putStringArrayList

List of usage examples for android.os Bundle putStringArrayList

Introduction

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

Prototype

@Override
public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) 

Source Link

Document

Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.skubit.android.billing.BillingServiceBinder.java

@Override
public Bundle getSkuDetails(int apiVersion, String userId, String packageName, String type, Bundle skusBundle)
        throws RemoteException {
    Bundle bundle = new Bundle();
    if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(type)) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR);
        return bundle;
    }//from w w  w  . j a  v a  2 s  .c o m

    if (apiVersion != 1) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE);
        return bundle;
    }

    if (skusBundle == null || !skusBundle.containsKey("ITEM_ID_LIST")) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR);
        return bundle;
    }

    if (!isValidType(type)) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE);
        return bundle;
    }

    int packValidate = validatePackageIsOwnedByCaller(packageName);
    if (packValidate != BillingResponseCodes.RESULT_OK) {
        bundle.putInt("RESPONSE_CODE", packValidate);
        return bundle;
    }

    String account = userId;
    if (!hasAccess(userId, packageName)) {
        Log.d(TAG, "User account not configured");
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_USER_ACCESS);
        return bundle;
    }
    Utils.changeAccount(mContext, userId);

    InventoryRestService service = new InventoryService(account, mContext).getRestService();

    ArrayList<String> itemIds = skusBundle.getStringArrayList("ITEM_ID_LIST");
    SkuDetailsListDto skuDetailsListDto = null;

    try {
        skuDetailsListDto = service.getSkuDetailsByIds(packageName, Joiner.on(",").join(itemIds));
    } catch (Exception e1) {
        e1.printStackTrace();
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_ERROR);
    }

    ArrayList<String> details = new ArrayList<String>();
    for (SkuDetailsDto skuDetailsDto : skuDetailsListDto.getItems()) {
        JSONObject jo = new JSONObject();
        try {
            jo.put("productId", skuDetailsDto.getProductId());
            jo.put("type", skuDetailsDto.getType().name());
            jo.put("price", String.valueOf(skuDetailsDto.getSatoshi()));
            jo.put("title", skuDetailsDto.getTitle());
            jo.put("description", skuDetailsDto.getDescription());
        } catch (JSONException e) {
            e.printStackTrace();
        }
        details.add(jo.toString());
    }

    bundle.putStringArrayList("DETAILS_LIST", details);
    bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_OK);

    return bundle;
}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name : createVideoLayout//www  .jav a  2 s  .com
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */

public void createVideoLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutVideo);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    int intial = 0;
    if (videoresGooruOid.size() > 4) {
        intial = videoresGooruOid.size() - 5;
    } else {
        videoRight.setVisibility(View.GONE);
    }

    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.video_ico));
        intial++;
        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + videoresGooruOid.size());
                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Video";
                resourceGooruId = videoresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", videoresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name :createslideLayout//from   w  w w  .  j  ava  2 s .c  om
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */
// slide
public void createslideLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutSlide);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;
    int intial = 0;
    if (slideresGooruOid.size() > 4) {
        intial = slideresGooruOid.size() - 5;
    } else {
        slideRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.slides_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + slideresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Slide";
                resourceGooruId = slideresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", slideresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);
            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name :createwebsiteLayout/*from  w ww .j av  a2s .com*/
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */
// website
public void createwebsiteLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutWebsite);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;
    int intial = 0;
    if (websiteresGooruOid.size() > 4) {
        intial = websiteresGooruOid.size() - 5;
    } else {
        websiteRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.website_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + websiteresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Website";
                resourceGooruId = websiteresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", websiteresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name :createhandoutLayout//from  www  .  j  a v  a2  s .  co  m
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */
// handout
public void createhandoutLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutHandout);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;
    int intial = 0;
    if (handoutresGooruOid.size() > 4) {
        intial = handoutresGooruOid.size() - 5;
    } else {
        handoutRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.handouts_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + handoutresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Handout";
                resourceGooruId = handoutresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", handoutresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name : createlessonLayout//from www  . j a v a2  s  .c  om
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */
// lesson
public void createlessonLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutLesson);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;
    int intial = 0;
    if (lessonresGooruOid.size() > 4) {
        intial = lessonresGooruOid.size() - 5;
    } else {
        lessonRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.lesson_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + lessonresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Lesson";
                resourceGooruId = lessonresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", lessonresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name :createinteractiveLayout
 * /*ww  w. jav  a 2 s .  c  o  m*/
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */
// interactive
public void createinteractiveLayout(List<String> resincUrls, List<String> resincTitle,
        List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutInteractive);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;
    int intial = 0;
    if (interactiveresGooruOid.size() > 4) {
        intial = interactiveresGooruOid.size() - 5;
    } else {
        interactiveRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.interactive_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + interactiveresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Interactive";
                resourceGooruId = interactiveresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", interactiveresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name :createtextbookLayout/*w  w w  . j  a  v  a  2s. com*/
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */
// textbook
public void createtextbookLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutTextbook);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;

    int intial = 0;
    if (textbookresGooruOid.size() > 4) {
        intial = textbookresGooruOid.size() - 5;
    } else {
        textbookRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.textbook_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + textbookresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Textbook";
                resourceGooruId = textbookresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", textbookresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java

/**
 * @function name :createexamLayout//from   w w  w .  j a  va2 s  .c om
 * 
 *           This function is used to add 5 more resources in horizontallist
 *           view.
 * 
 * @param 5 list(resUrls, resTitles, resCategory, resDescription,
 *        resGooruOid);
 * 
 * @return void
 * 
 * 
 */

// exam
public void createexamLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory,
        List<String> resincDescription, List<String> resincGooruid) {

    LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutExam);
    int size = resincUrls.size();
    Log.i("Size to check :", "" + size);
    List<String> resTempincGooruid = new ArrayList<String>();
    resTempincGooruid = resincGooruid;
    int intial = 0;
    if (examresGooruOid.size() > 4) {
        intial = examresGooruOid.size() - 5;
    } else {
        examRight.setVisibility(View.GONE);
    }
    Log.i("intial", "" + intial);
    for (int i = 0; i < size; i++) {
        resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
        TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
        title.setText(nullCheck(resincTitle.get(i), "None Added"));

        TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource);
        category.setText(nullCheck(resincCategory.get(i), "None Added"));

        TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription);
        descr.setText(nullCheck(resincDescription.get(i), "None Added"));

        FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes);
        image.setImage(resUrls.get(i), R.drawable.resourcedefault);

        resourcelayout.setTag(intial);
        imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory);
        imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.exam_ico));
        intial++;

        scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180));
        resourcelayout.setPadding(10, 0, 10, 0);
        resourcelayout.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                int s = (Integer) v.getTag();
                Log.i("Size  completeGooruOid :", "" + examresGooruOid.size());

                // Flurry Log
                flag_isPlayerTransition = true;
                resourceType = "Exam";
                resourceGooruId = examresGooruOid.get(s);

                Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class);
                Bundle extras = new Bundle();
                extras.putInt("key", s);
                extras.putString("token", token);
                extras.putString("searchkey", searchKeyword);
                extras.putStringArrayList("goor", examresGooruOid);
                intentResPlayer.putExtras(extras);
                startActivity(intentResPlayer);

            }
        });
    }

}

From source file:br.org.funcate.dynamicforms.FragmentDetailActivity.java

private void saveAction() throws Exception {

    FragmentDetail detailFragment = (FragmentDetail) getSupportFragmentManager()
            .findFragmentById(R.id.detailFragment);
    if (detailFragment != null) {
        detailFragment.storeFormItems(false);
    }//from w  w w.  j a v  a2 s  . com

    if (sectionObject == null) {
        throw new Exception(this.getString(R.string.session_object_exception));
    }

    // extract and check constraints
    List<String> availableFormNames = TagsManager.getFormNames4Section(sectionObject);
    Bundle formData = null;

    if (availableFormNames.isEmpty()) {
        throw new Exception(this.getString(R.string.session_object_exception));
    }

    for (String formNameIt : availableFormNames) {
        JSONObject formObject = TagsManager.getForm4Name(formNameIt, sectionObject);
        JSONArray formItemsArray = TagsManager.getFormItems(formObject);

        int length = formItemsArray != null ? formItemsArray.length() : 0;
        formData = new Bundle(length);
        ArrayList<String> keys = new ArrayList<String>(length);
        ArrayList<String> types = new ArrayList<String>(length);

        String key = "";
        String value = "";
        String type = "";
        boolean insertKey;// This control flag is used to ignore some types because are simply ignored or are manipulated in other time.

        for (int i = 0; i < length; i++) {
            JSONObject jsonObject = formItemsArray.getJSONObject(i);

            if (jsonObject.has(TAG_KEY))
                key = jsonObject.getString(TAG_KEY).trim();

            if (jsonObject.has(TAG_VALUE)) {
                value = jsonObject.getString(TAG_VALUE).trim();
            }

            if (jsonObject.has(TAG_TYPE)) {
                type = jsonObject.getString(TAG_TYPE).trim();
            }

            if (!key.equals("") && !value.equals("") && !type.equals("")) {

                insertKey = true;

                if (type.equals(TYPE_STRING)) {
                    formData.putString(key, value);
                } else if (type.equals(TYPE_STRINGAREA)) {
                    formData.putString(key, value);
                } else if (type.equals(TYPE_DOUBLE)) {
                    formData.putDouble(key, Double.valueOf(value));
                } else if (type.equals(TYPE_INTEGER)) {
                    formData.putInt(key, Integer.valueOf(value));
                } else if (type.equals(TYPE_DATE)) {
                    formData.putString(key, value);
                } else if (type.equals(TYPE_TIME)) {
                    formData.putString(key, value);
                } else if (type.equals(TYPE_LABEL)) {
                    insertKey = false;
                    //formData.putString(key, value);
                } else if (type.equals(TYPE_LABELWITHLINE)) {
                    insertKey = false;
                    //formData.putString(key, value);
                } else if (type.equals(TYPE_BOOLEAN)) {
                    formData.putBoolean(key, Boolean.valueOf(value));
                } else if (type.equals(TYPE_STRINGCOMBO)) {
                    formData.putString(key, value);
                } else if (type.equals(TYPE_CONNECTEDSTRINGCOMBO)) {
                    formData.putString(key, value);
                } else if (type.equals(TYPE_STRINGMULTIPLECHOICE)) {
                    insertKey = false;
                    //formData.putString(key,value);
                } else if (type.equals(TYPE_PICTURES)) {
                    insertKey = false;
                    // Using the new key to represent a list of image paths. It is manipulated on posterior time.
                    //formData.putString(key,value);
                    decodeFromJson(value, formData);
                }

                if (insertKey) {
                    keys.add(key);
                    types.add(type);
                }

            }
        }
        formData.putStringArrayList(LibraryConstants.FORM_TYPES, types);
        formData.putStringArrayList(LibraryConstants.FORM_KEYS, keys);

        if (sectionObject.has(FormUtilities.ATTR_GEOJSON_TAGS)) {
            JSONObject geojsonGeometry = sectionObject.getJSONObject(FormUtilities.ATTR_GEOJSON_TAGS);
            formData.putString(FormUtilities.ATTR_GEOJSON_TAGS, geojsonGeometry.toString());
        }

        if (pointId >= 0) {
            formData.putLong(FormUtilities.GEOM_ID, pointId);
        }

        if (existingFeatureData != null) {
            formData.putBundle(FormUtilities.ATTR_DATA_VALUES, existingFeatureData);
        }
    }

    if (formData == null) {
        throw new Exception(this.getString(R.string.session_object_exception));
    }
    Intent intent = getIntent();
    intent.putExtra(LibraryConstants.PREFS_KEY_FORM, formData);
    setResult(Activity.RESULT_OK, intent);
    finish();
}