Example usage for android.widget LinearLayout addView

List of usage examples for android.widget LinearLayout addView

Introduction

In this page you can find the example usage for android.widget LinearLayout addView.

Prototype

public void addView(View child, int index) 

Source Link

Document

Adds a child view.

Usage

From source file:com.shengtao.chat.chatUI.adapter.MessageAdapter.java

private void setRobotMenuMessageLayout(LinearLayout parentView, JSONArray jsonArr) {
    try {// w w w  . j  ava  2s  .c om
        parentView.removeAllViews();
        for (int i = 0; i < jsonArr.length(); i++) {
            final String itemStr = jsonArr.getString(i);
            final TextView textView = new TextView(context);
            textView.setText(itemStr);
            textView.setTextSize(15);
            try {
                XmlPullParser xrp = context.getResources().getXml(drawable.menu_msg_text_color);
                textView.setTextColor(ColorStateList.createFromXml(context.getResources(), xrp));
            } catch (Exception e) {
                e.printStackTrace();
            }
            textView.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    ((ChatActivity) context).sendText(itemStr);
                }
            });
            LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
            llLp.bottomMargin = DensityUtil.dip2px(context, 3);
            llLp.topMargin = DensityUtil.dip2px(context, 3);
            parentView.addView(textView, llLp);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

}

From source file:cn.ucai.superwechat.adapter.MessageAdapter.java

@SuppressWarnings("ResourceType")
private void setRobotMenuMessageLayout(LinearLayout parentView, JSONArray jsonArr) {
    try {//from  w w  w  .j  av  a 2s.  c om
        parentView.removeAllViews();
        for (int i = 0; i < jsonArr.length(); i++) {
            final String itemStr = jsonArr.getString(i);
            final TextView textView = new TextView(context);
            textView.setText(itemStr);
            textView.setTextSize(15);
            try {
                XmlPullParser xrp = context.getResources()
                        .getXml(cn.ucai.superwechat.R.drawable.menu_msg_text_color);
                textView.setTextColor(ColorStateList.createFromXml(context.getResources(), xrp));
            } catch (Exception e) {
                e.printStackTrace();
            }
            textView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    ((ChatActivity) context).sendText(itemStr);
                }
            });
            LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
            llLp.bottomMargin = DensityUtil.dip2px(context, 3);
            llLp.topMargin = DensityUtil.dip2px(context, 3);
            parentView.addView(textView, llLp);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

}

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

public void createAllEmpty() {
    videoRight.setVisibility(View.GONE);
    interactiveRight.setVisibility(View.GONE);
    websiteRight.setVisibility(View.GONE);
    textbookRight.setVisibility(View.GONE);
    examRight.setVisibility(View.GONE);
    handoutRight.setVisibility(View.GONE);
    slideRight.setVisibility(View.GONE);
    lessonRight.setVisibility(View.GONE);
    LinearLayout tempLayout = (LinearLayout) findViewById(R.id.layoutHandout);
    tempLayout.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout1 = (LinearLayout) findViewById(R.id.layoutExam);
    tempLayout1.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout2 = (LinearLayout) findViewById(R.id.layoutInteractive);
    tempLayout2.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout3 = (LinearLayout) findViewById(R.id.layoutSlide);
    tempLayout3.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout4 = (LinearLayout) findViewById(R.id.layoutTextbook);
    tempLayout4.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout5 = (LinearLayout) findViewById(R.id.layoutVideo);
    tempLayout5.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout6 = (LinearLayout) findViewById(R.id.layoutWebsite);
    tempLayout6.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    LinearLayout tempLayout7 = (LinearLayout) findViewById(R.id.layoutLesson);
    tempLayout7.addView(createResourceEmptyView(), new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
}

From source file:com.com.easemob.chatuidemo.adapter.MessageAdapter.java

private void setRobotMenuMessageLayout(LinearLayout parentView, JSONArray jsonArr) {
    try {//from   w  ww .  ja  v a  2 s .com
        parentView.removeAllViews();
        for (int i = 0; i < jsonArr.length(); i++) {
            final String itemStr = jsonArr.getString(i);
            final TextView textView = new TextView(context);
            textView.setText(itemStr);
            textView.setTextSize(15);
            try {
                XmlPullParser xrp = context.getResources().getXml(R.drawable.menu_msg_text_color);
                textView.setTextColor(ColorStateList.createFromXml(context.getResources(), xrp));
            } catch (Exception e) {
                e.printStackTrace();
            }
            textView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    ((ChatMessage) context).sendText(itemStr);
                }
            });
            LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
            llLp.bottomMargin = DensityUtil.dip2px(context, 3);
            llLp.topMargin = DensityUtil.dip2px(context, 3);
            parentView.addView(textView, llLp);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragmentOverzicht.java

/**
 * Populate the koopman fragment item details item when the loader has finished
 * @param loader the cursor loader/*from   www. j  ava2s .  c om*/
 * @param data data object containing one or more koopman rows with joined sollicitatie data
 */
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null && data.moveToFirst()) {

        // get the markt id from the sharedprefs
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext());
        int marktId = settings.getInt(getContext().getString(R.string.sharedpreferences_key_markt_id), 0);

        // koopman photo
        Glide.with(getContext())
                .load(data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_FOTO_URL)))
                .error(R.drawable.no_koopman_image).into(mKoopmanFotoImage);

        // koopman naam
        String naam = data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_VOORLETTERS)) + " "
                + data.getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ACHTERNAAM));
        mKoopmanVoorlettersAchternaamText.setText(naam);

        // koopman erkenningsnummer
        String erkenningsnummer = data
                .getString(data.getColumnIndex(MakkelijkeMarktProvider.Koopman.COL_ERKENNINGSNUMMER));
        mErkenningsnummerText.setText(erkenningsnummer);

        // koopman sollicitaties
        View view = getView();
        if (view != null) {
            LayoutInflater layoutInflater = (LayoutInflater) getActivity()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            LinearLayout placeholderLayout = (LinearLayout) view.findViewById(R.id.sollicitaties_placeholder);
            placeholderLayout.removeAllViews();

            // add multiple markt sollicitatie views to the koopman items
            while (!data.isAfterLast()) {

                // inflate sollicitatie layout and populate its view items
                View childLayout = layoutInflater.inflate(R.layout.dagvergunning_koopman_item_sollicitatie,
                        null);

                // highlight the sollicitatie for the current markt
                if (data.getCount() > 1 && marktId > 0 && marktId == data
                        .getInt(data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_MARKT_ID))) {
                    childLayout.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary));
                }

                // markt afkorting
                String marktAfkorting = data
                        .getString(data.getColumnIndex(MakkelijkeMarktProvider.Markt.COL_AFKORTING));
                TextView marktAfkortingText = (TextView) childLayout
                        .findViewById(R.id.sollicitatie_markt_afkorting);
                marktAfkortingText.setText(marktAfkorting);

                // koopman sollicitatienummer
                String sollicitatienummer = data.getString(
                        data.getColumnIndex(MakkelijkeMarktProvider.Sollicitatie.COL_SOLLICITATIE_NUMMER));
                TextView sollicitatienummerText = (TextView) childLayout
                        .findViewById(R.id.sollicitatie_sollicitatie_nummer);
                sollicitatienummerText.setText(sollicitatienummer);

                // koopman sollicitatie status
                String sollicitatieStatus = data.getString(data.getColumnIndex("sollicitatie_status"));
                TextView sollicitatieStatusText = (TextView) childLayout.findViewById(R.id.sollicitatie_status);
                sollicitatieStatusText.setText(sollicitatieStatus);
                if (sollicitatieStatus != null && !sollicitatieStatus.equals("?")
                        && !sollicitatieStatus.equals("")) {
                    sollicitatieStatusText
                            .setTextColor(ContextCompat.getColor(getContext(), android.R.color.white));
                    sollicitatieStatusText.setBackgroundColor(ContextCompat.getColor(getContext(),
                            Utility.getSollicitatieStatusColor(getContext(), sollicitatieStatus)));
                }

                // add view and move cursor to next
                placeholderLayout.addView(childLayout, data.getPosition());
                data.moveToNext();
            }
        }
    }
}

From source file:com.hughes.android.dictionary.DictionaryActivity.java

private void onCreateSetupActionBarAndSearchView() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);

    final LinearLayout customSearchView = new LinearLayout(getSupportActionBar().getThemedContext());

    final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    customSearchView.setLayoutParams(layoutParams);

    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override//  w  w w  . j  av  a2  s .c  o  m
        public void onItemClick(AdapterView<?> parent, View view, int row, long id) {
            onListItemClick(getListView(), view, row, id);
        }
    });

    languageButton = new ImageButton(customSearchView.getContext());
    languageButton.setScaleType(ScaleType.FIT_CENTER);
    languageButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            onLanguageButtonClick();
        }
    });
    languageButton.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            onLanguageButtonLongClick(v.getContext());
            return true;
        }
    });
    languageButton.setAdjustViewBounds(true);
    LinearLayout.LayoutParams lpb = new LinearLayout.LayoutParams(application.languageButtonPixels,
            LinearLayout.LayoutParams.MATCH_PARENT);
    customSearchView.addView(languageButton, lpb);

    searchView = new SearchView(getSupportActionBar().getThemedContext());

    // Get rid of search icon, it takes up too much space.
    // There is still text saying "search" in the search field.
    searchView.setIconifiedByDefault(true);
    searchView.setIconified(false);

    searchView.setQueryHint(getString(R.string.searchText));
    searchView.setSubmitButtonEnabled(false);
    searchView.setInputType(InputType.TYPE_CLASS_TEXT);
    searchView.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI |
    // EditorInfo.IME_FLAG_NO_FULLSCREEN | // Requires API
    // 11
            EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    onQueryTextListener = new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            Log.d(LOG, "OnQueryTextListener: onQueryTextSubmit: " + searchView.getQuery());
            hideKeyboard();
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            Log.d(LOG, "OnQueryTextListener: onQueryTextChange: " + searchView.getQuery());
            onSearchTextChange(searchView.getQuery().toString());
            return true;
        }
    };
    searchView.setOnQueryTextListener(onQueryTextListener);
    searchView.setFocusable(true);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, FrameLayout.LayoutParams.WRAP_CONTENT, 1);
    customSearchView.addView(searchView, lp);

    actionBar.setCustomView(customSearchView);
    actionBar.setDisplayShowCustomEnabled(true);

    // Avoid wasting space on large left inset
    Toolbar tb = (Toolbar) customSearchView.getParent();
    tb.setContentInsetsRelative(0, 0);
}

From source file:com.google.samples.apps.iosched.ui.widget.CollectionView.java

private View createGroupView(RowComputeResult rowInfo, View view, ViewGroup parent) {
    ViewGroup groupView;//from w ww  .j  av  a2s  .  c  om
    if (view != null && view instanceof ViewGroup) {
        groupView = (ViewGroup) view;
        // If there are more children in the recycled view we remove the extra ones.
        if (groupView.getChildAt(0) instanceof LinearLayout) {
            LinearLayout groupViewContent = (LinearLayout) groupView.getChildAt(0);
            if (groupViewContent.getChildCount() > rowInfo.group.getRowCount()) {
                groupViewContent.removeViews(rowInfo.group.getRowCount(),
                        groupViewContent.getChildCount() - rowInfo.group.getRowCount());
            }
        }
        // Use the defined callbacks if the user has chosen to by implementing a
        // CardsCollectionViewCallbacks.
    } else if (mCallbacks instanceof CollectionViewCallbacks.GroupCollectionViewCallbacks) {
        groupView = ((CollectionViewCallbacks.GroupCollectionViewCallbacks) mCallbacks)
                .newCollectionGroupView(getContext(), rowInfo.groupId, rowInfo.group, parent);
        // This should never happened but if it does we'll display an EmptyView.
    } else {
        LOGE(TAG, "Tried to create a group view but the callback is not an instance of "
                + "GroupCollectionViewCallbacks");
        return new EmptyView(getContext());
    }
    LinearLayout groupViewContent;
    if (groupView.getChildAt(0) instanceof LinearLayout) {
        groupViewContent = (LinearLayout) groupView.getChildAt(0);
    } else {
        groupViewContent = new LinearLayout(getContext());
        groupViewContent.setOrientation(LinearLayout.VERTICAL);
        LayoutParams LLParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        groupViewContent.setLayoutParams(LLParams);
        groupView.addView(groupViewContent);
    }
    disableCustomGroupView();
    for (int i = 0; i < rowInfo.group.getRowCount(); i++) {
        View itemView;
        try {
            itemView = getRowView(rowInfo.groupOffset + i, groupViewContent.getChildAt(i), groupViewContent);
        } catch (Exception e) {
            // Recycling failed (maybe the items were not compatible) so we start again without
            // recycling.
            itemView = getRowView(rowInfo.groupOffset + i, null, groupViewContent);
        }
        if (itemView != groupViewContent.getChildAt(i)) {
            if (groupViewContent.getChildCount() > i) {
                groupViewContent.removeViewAt(i);
            }
            groupViewContent.addView(itemView, i);
        }
    }
    enableCustomGroupView();
    return groupView;
}

From source file:com.example.fragmentdemo.views.PagerSlidingTabStrip.java

private void addTab(final int position, CharSequence title, int iconResId, int iLayoutResId, int iTextId,
        int iIconLocation) {
    // final View tabView = ((Activity) getContext()).getLayoutInflater()
    // .inflate(iLayoutResId, null);
    // TextView tab_text_textview = (TextView)
    // tabView.findViewById(iTextId);
    // tab_text_textview.setText(title);
    LinearLayout tabView = new LinearLayout(getContext());
    tabView.setGravity(Gravity.CENTER);//  w ww .j  a v  a2s .  c  o m
    TextView tab_text_textview = new TextView(getContext());
    tab_text_textview.setId(position);
    tab_text_textview.setText(title);
    tab_text_textview.setGravity(Gravity.CENTER_VERTICAL);
    tab_text_textview.setSingleLine();
    // tab_text_textview.setTextColor(tabTextColor);
    // tab_text_textview.setTextColor(getResources().getColor(R.color.indicator_tab_main_text_color));
    XmlPullParser xrp = getResources().getXml(tabTextColor);
    try {
        ColorStateList csl = ColorStateList.createFromXml(getResources(), xrp);

        if (tab_text_textview != null) {
            tab_text_textview.setTextColor(csl);
        }
    } catch (Exception e) {

    }
    tab_text_textview.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
    tab_text_textview.setTypeface(tabTypeface, tabTypefaceStyle);
    LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    if (iconResId != 0) {
        // tab_text_textview.setCompoundDrawablesWithIntrinsicBounds(
        // iconResId, 0, 0, 0);
        // Drawable mDrawable = ((Activity) getContext()).getResources()
        // .getDrawable(iconResId);
        // mDrawable.setBounds(0, 0, mDrawable.getMinimumWidth(),
        // mDrawable.getMinimumHeight());
        int iPandding = (int) ((Activity) getContext()).getResources().getDimension(R.dimen.common_padding);
        ImageView icon = new ImageView(getContext());
        icon.setImageResource(iconResId);
        icon.setScaleType(ScaleType.CENTER_INSIDE);
        LinearLayout.LayoutParams lpImage = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                iIconHeight);

        switch (iIconLocation) {
        case 1:
            // tab_text_textview.setCompoundDrawables(mDrawable, null, null,
            // null);
            tabView.setOrientation(LinearLayout.HORIZONTAL);
            // tabView.setGravity(Gravity.CENTER_VERTICAL);

            tabView.addView(icon, lpImage);
            lpText.leftMargin = iPandding;
            tabView.addView(tab_text_textview, lpText);
            break;
        case 2:
            // tab_text_textview.setCompoundDrawables(null, mDrawable, null,
            // null);
            tabView.setOrientation(LinearLayout.VERTICAL);
            // tabView.setGravity(Gravity.CENTER_HORIZONTAL);
            tabView.addView(icon, lpImage);
            lpText.topMargin = iPandding;
            tabView.addView(tab_text_textview, lpText);
            break;
        case 3:
            // tab_text_textview.setCompoundDrawables(null, null, mDrawable,
            // null);
            tabView.setOrientation(LinearLayout.HORIZONTAL);
            // tabView.setGravity(Gravity.CENTER_VERTICAL);
            tabView.addView(tab_text_textview, lpText);
            lpImage.leftMargin = iPandding;
            tabView.addView(icon, lpImage);
            break;
        case 4:
            // tab_text_textview.setCompoundDrawables(null, null, null,
            // mDrawable);
            tabView.setOrientation(LinearLayout.VERTICAL);
            // tabView.setGravity(Gravity.CENTER_HORIZONTAL);
            tabView.addView(tab_text_textview, lpText);
            lpImage.topMargin = iPandding;
            tabView.addView(icon, lpImage);
            break;
        default:
            // tab_text_textview.setCompoundDrawables(mDrawable, null, null,
            // null);
            tabView.setOrientation(LinearLayout.HORIZONTAL);
            // tabView.setGravity(Gravity.CENTER_VERTICAL);
            tabView.addView(icon, lpImage);
            lpText.leftMargin = iPandding;
            tabView.addView(tab_text_textview, lpText);
            break;
        }

        // tab_text_textview
        // .setCompoundDrawablePadding((int) ((Activity) getContext())
        // .getResources()
        // .getDimension(R.dimen.common_padding));

    } else {
        tabView.addView(tab_text_textview, lpText);
    }

    tabView.setFocusable(true);
    tabView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });

    // tab_text_textview.setPadding(tabPadding, 0, tabPadding, 0);
    tabsContainer.addView(tabView, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams);
}

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

public LinearLayout createResourceEmptyView() {

    LinearLayout scrollChild = new LinearLayout(this);
    scrollChild.setPadding(10, 0, 10, 0);
    resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null);
    TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle);
    title.setText("Sorry! No Results Found");
    title.setTextColor(getResources().getColor(R.color.Grey));
    title.setPadding(50, 50, 0, 10);/*from ww  w .  j a  v a  2  s. c om*/
    title.setTextSize(25);

    scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.MATCH_PARENT));
    scrollChild.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
    return scrollChild;
}

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

/**
 * @function name : createVideoLayout/*from   w  ww. 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
 * 
 * 
 */

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);

            }
        });
    }

}