Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:01:16+00:00 2026-06-02T06:01:16+00:00

I am making listview which data fill by json parsing,I am using Customadapter in

  • 0

I am making listview which data fill by json parsing,I am using Customadapter in getview I am setting textviews according to condition into listview.My requirement is that when I am click row of listview I can retrieve the id’s of item of clicked row of listview,but problem is that i unnable to getting the id of item.So please any one help me I am in danger zone I am using this code–

public View getView(final int position, View convertView,
            ViewGroup parent) {
        // TODO Auto-generated method stub

        final MyVoucherOffer voucherOffer = (MyVoucherOffer) voucherListAdapter
                .get(position); // Remove offer

        LayoutInflater inflater = (LayoutInflater) VoucherActiveScreen.this
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        getIs_bidding = voucherOffer.getIs_bidding();
        Log.i("==getIs_bidding==", getIs_bidding);

        getResale_price = voucherOffer.getResale_price();
        Log.i("==getResale_price==", getResale_price);
        /*if (listType == 3) {
            convertView = inflater.inflate(R.layout.voucher_inactive_list,
                    null);
        } else if(listType == 1){
            convertView = inflater.inflate(R.layout.voucher_active_list,
                    null);
        }else if(listType == 2){
            convertView = inflater.inflate(R.layout.bidding_list, null);
        }*/

        //Code Added

        if (listType == 3) {
            convertView = inflater.inflate(R.layout.voucher_inactive_list,
                    null);
        } else{
            convertView = inflater.inflate(R.layout.voucher_active_list,
                    null);
        }

        //
        // 1. offerTitle-
        // 2. offerPricce
        // 3. star
        // 4. offerDiscription
        // 5. condition
        // 6. number
        ProgressBar progress = (ProgressBar) convertView
        .findViewById(R.id.progressBar1);


        RelativeLayout mylayout = (RelativeLayout) convertView
                .findViewById(R.id.mylayoutV);
        ImageView dealImage1 = (ImageView) convertView
                .findViewById(R.id.dealImageV);
        ImageView birds = (ImageView) convertView
        .findViewById(R.id.birds);


        int z = position % 2;
        if (z == 1) {
            mylayout.setBackgroundResource(R.drawable.dark_gray);
        }

        ArrayList<String> al = voucherOffer.getImageOffer();
        if (al.size() > 0) {
            String url = al.get(0).toString();
            url = "http://bma.in/ian_watt/application/views/scripts/vendor/uploads/"
                    + url;

            try {

                dealImage1.setTag(url);
                imageloader.DisplayImageLoader(url, VoucherActiveScreen.this,
                        dealImage1,progress);

            } catch (Exception e) {
                // TODO: handle exception
                Log.e("error", e.getMessage().toString());
            }
        } else {
            dealImage1.setImageResource(R.drawable.no_img);
        }
        ImageButton arrow = (ImageButton) convertView
                .findViewById(R.id.list_arrowV);
        TextView offerTitle = (TextView) convertView
                .findViewById(R.id.offerTitleV);
        offerTitle.setText(voucherOffer.getFld_name());
        TextView offerPrice = (TextView) convertView
                .findViewById(R.id.offerPriceV);

        offerTitle.setTypeface(font_bold);

        // offerTitle.setText(localMapOffer.getOffer_price()));number
        Log.v("", voucherOffer.getOffer_price());


        try {
            double op = Double.parseDouble(voucherOffer.getOffer_price());

            double cp = Double
                    .parseDouble(voucherOffer.getCustomer_price());

            if (listType == 3)
            {
                if (voucherOffer.getIs_redeem().toString().equals("1")
                        || voucherOffer.getIs_redeem().toString() == "1") {
                    offerPrice.setTypeface(font_bold);
                    offerPrice.setText("Rate");
                } else {
                    offerPrice.setTypeface(font);
                    offerPrice.setText("View");
                }
            } else {
                if (op - cp == 0.0) {
                    offerPrice.setText("Free");
                } else {
                    offerPrice.setText("$" + voucherOffer.getOffer_price());
                }
            }

        } catch (Exception e) {
            // TODO: handle exception
            Log.e("error", e.getMessage().toString());
        }

        if (listType == 3)
        {
            TextView star = (TextView) convertView
                    .findViewById(R.id.starVText);
            star.setTypeface(font_bold);
            Log.e("!!!!!!!!!! VoucherActive", " V :: "
                    + voucherOffer.getIs_redeem().toString());
            if (voucherOffer.getIs_redeem().toString().equals("1")
                    || voucherOffer.getIs_redeem().toString() == "1") {
                star.setText("Redeemed "
                        + getStringDate(voucherOffer.getModified()
                                .toString()));
            } else if (voucherOffer.getIs_sold().toString().equals("1")
                    || voucherOffer.getIs_sold().toString() == "1") {
                star.setText("Sold "
                        + getStringDate(voucherOffer.getModified()
                                .toString()));
            } else if (voucherOffer.getIs_expired().toString().equals("1")
                    || voucherOffer.getIs_expired().toString() == "1") {
                star.setText("Expired "
                        + getStringDate(voucherOffer.getModified()
                                .toString()));
            }

        } else {

            if(voucherOffer.getIs_bidding().equalsIgnoreCase("1"))
                birds.setVisibility(View.VISIBLE);
            ImageView star = (ImageView) convertView
                    .findViewById(R.id.starV);
            hm = Data.getValue(hm);
            Log.v(",val", voucherOffer.getFld_rating() + "");
            if (hm.containsKey(voucherOffer.getFld_rating())) {
                star.setImageResource(hm.get(voucherOffer.getFld_rating()));

            }
            /*else if(voucherOffer.getIs_bidding().equalsIgnoreCase("0") && voucherOffer.getResale_price().equalsIgnoreCase("0.00")){

            }*/
        }
        TextView offerDiscription = (TextView) convertView
                .findViewById(R.id.discriptionV);
        offerDiscription.setText(voucherOffer.getOffer_title());

        offerDiscription.setTypeface(font);

        TextView dayV = (TextView) convertView.findViewById(R.id.dayV);

        TextView distance = (TextView) convertView
                .findViewById(R.id.distacneV);

        if (listType == 3) {
            if (voucherOffer.getIs_redeem().toString().equals("1")
                    || voucherOffer.getIs_redeem().toString() == "1") {
                distance.setTypeface(font_bold);
                distance.setText("This");
            } else {
                distance.setTypeface(font);
                distance.setText("Voucher");
            }
        } else {
            distance.setTypeface(font);
            if (voucherOffer.getDistance().length() > 5) {
                distance.setText(voucherOffer.getDistance().substring(0, 4)
                        + "m");

            } else {
                distance.setText(voucherOffer.getDistance() + "m");
            }
        }

        try {

            DateFormat df = new SimpleDateFormat("MM/dd/yy");

            Date today = df.parse(voucherOffer.getOffer_enddate());
            Log.v("today", today.toString());
            long endDate = today.getTime();
            Calendar currentDate = Calendar.getInstance();
            long current = currentDate.getTimeInMillis();

            Log.v("current milis", "" + current);
            long cal = endDate - current;

            if (listType == 3) {
                if (voucherOffer.getIs_redeem().toString().equals("1")
                        || voucherOffer.getIs_redeem().toString() == "1") {
                    dayV.setTypeface(font_bold);
                    dayV.setText("Deal");
                } else {
                    dayV.setTypeface(font);
                    dayV.setText("Page");
                }
            } else {
                dayV.setTypeface(font);
                dayV.setText(getDay(cal));
            }

        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }

        mylayout.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                try {



                  ---------------------my problem section----------------------------



                    if (listType == 1) {
                        Log.v("active", "On Click " + (position));
                        if(Integer.parseInt(ParsingData.is_bid) == 1 && Integer.parseInt(ParsingData.is_resale) == 0){
                             System.out.println("inside first case");
                            Intent intent = new Intent(
                                    VoucherActiveScreen.this,
                                    MyVoucherDetailPage.class);
                            intent.putExtra("selectedIndex", position);
                            intent.putExtra("listType", listType);
                            intent.putExtra("isPurchasedVoucher ", false);
                            startActivity(intent);
                        }
                        else{
                            System.out.println("inside else case");
                            Intent intent = new Intent(
                                    VoucherActiveScreen.this,
                                    MyVoucherDetailPage.class);
                            intent.putExtra("selectedIndex", position);
                            intent.putExtra("isPurchasedVoucher ", true);
                            intent.putExtra("listType", listType);
                            startActivity(intent);
                ------------------------end----------------------------
                        }
                    }
                    //Code Added
                    /*else if(listType == 2){
                        Log.v("Bidding", "On Click " + (position));
                        Intent intent = new Intent(VoucherActiveScreen.this, 
                                MyVoucherDetailPage.class);
                        intent.putExtra("selectedIndex", position);
                        intent.putExtra("listType", listType);
                        startActivity(intent);
                    }*/else if (listType == 3) {
                        Intent intent = new Intent(
                                VoucherActiveScreen.this,
                                MyVoucherDetailPage.class);
                        intent.putExtra("listType", listType);
                        intent.putExtra("selectedIndex", position);
                        Log.v("inactive", "On Click " + (position));

                        startActivity(intent);
                    }
                } catch (Exception e) {
                    // TODO: handle exception
                }
            }
        });

        return convertView;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:01:18+00:00Added an answer on June 2, 2026 at 6:01 am

    You can do this by setting id where you setting text. You can set your id through setId(id), then as per Bobbake4 said you can get it using view.getID().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Making an adobe flex ui in which data that is calculated must use proprietary
im making an app that interacs with a webservie which then gets data from
I am making a widget for one of my applications which includes a ListView
I'm not entirely sure which part of my code is making this happen. This
I have a gridview and listview in my aspx pages which both display tables
I have an activity which have a button and a listview(with chechbox, image and
I have a class like this which stores some data to later make a
I am making an android app in which I am trying to lazyload and
I was making an application which uses list for displaying the details of a
I am new to android coding and was making a project with ListView. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.