title: Pass a variable value from Base Adapter to activity
body: <p>I have a set a variable in my Base Adapter class, now I want to get(pass) this variable in my related Activity. I am not getting how to do this.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>  public class TourDescAdapter extends BaseAdapter {
  
      private List&lt;Descriptions&gt; descriptList;
      private LayoutInflater mInflater;
      ViewHolder holder;
      @SuppressWarnings("unused")
      private OnClickListener clickListener; 
      Activity context;
      //TourDescription tourDesc;
      ArrayList&lt;HashMap&lt;String, Object&gt;&gt; obj = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;();
      HashMap&lt;String, Object&gt; discountedTourDetails = null;
      String price = null, prodId = null;
      String promoTourname, tourName;
  
      public TourDescAdapter(List&lt;Descriptions&gt; descriptList,
              TourDescription activity) {
          this.context = activity;
          this.descriptList = descriptList;
          mInflater = LayoutInflater.from(activity);
          clickListener = (OnClickListener) activity;
  
      }
  
      @Override
      public int getCount() {
  
          return this.descriptList.size();
      }
  
      @Override
      public Object getItem(int position) {
  
          return this.descriptList.get(position);
  
      }
  
      @Override
      public long getItemId(int position) {
  
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          if (convertView == null) {
              convertView = mInflater.inflate(R.layout.tourlist, null);
  
              /****
               * Creates a ViewHolder and store references to the two children
               * views we want to bind data to
               ****/
              holder = new ViewHolder();
              holder.rlayout = (RelativeLayout) convertView
                      .findViewById(R.id.tourlayout);
  
              holder.title = (TextView) convertView
                      .findViewById(R.id.tourtitletext);
              holder.desc = (TextView) convertView.findViewById(R.id.tourdes);
              holder.amountButton = (Button) convertView
                      .findViewById(R.id.amtBtn);
              holder.pinButton = (Button) convertView.findViewById(R.id.pinBtn);
              holder.arrowButton = (Button)convertView.findViewById(R.id.arrowBtn);
              holder.serialText = (EditText)convertView.findViewById(R.id.pinText);
              convertView.setTag(holder);
  
          } else {
  
              holder = (ViewHolder) convertView.getTag();
          }
  
          holder.title.setText((String) descriptList.get(position)
                  .getImageTitle());
          holder.desc.setText((String) descriptList.get(position)
                  .getImageDescription());
          ((ImageView) holder.rlayout.getChildAt(0)).setImageBitmap(BitmapFactory
                  .decodeFile((RaconTours.PATH + RaconTours.city + File.separator
                          + TourDescription.currentTour.getObjtourName()
                          + File.separator + descriptList.get(position)
                          .getImagePath().split("/")[2]).replace(" ", "_")));
  
          if (position == 0) {
              SharedPreferences settings = context.getSharedPreferences("downloadDetails", 0);
              String isTourDownloaded = settings.getString(TourDescription.currentTour.getObjtourName(), "");
              if (isTourDownloaded.equals("true")) {
              //if (!(TourDescription.downloadFile.exists())||TourDescription.downloadFile.exists() == false ) {
              //if (TourDescription.currentTour.getIsTourDownloaded() == true) {
                  //holder.pinButton.setVisibility(View.INVISIBLE);
                  //holder.arrowButton.setVisibility(View.INVISIBLE);
                  //holder.serialText.setVisibility(View.INVISIBLE);
                  }
                  holder.amountButton.setVisibility(View.VISIBLE);
                  holder.amountButton.setText("Start");
  
  
  
              } else {
                  File promoPlistPath = new File(RaconTours.PATH + "promocode.txt");
                  checkPromoCode(promoPlistPath);
                  if (discountedTourDetails != null) {
                      tourName = (String) discountedTourDetails.get("promoTour");
                      price = (String) discountedTourDetails.get("discountPrice");
                      prodId = (String) discountedTourDetails.get("disProId");
  
                      holder.amountButton.setVisibility(View.VISIBLE);
                      // Setting the background color
                      holder.title
                              .setBackgroundColor(Color.parseColor("#993333"));
                      // Setting the Title color
                      holder.title.setTextColor(Color.WHITE);
                      // Centering the title
                      holder.title.setGravity(Gravity.LEFT);
                      // setting the city
                      ((TextView) holder.rlayout.getChildAt(1))
                              .setText(RaconTours.city);
                      ((TextView) holder.rlayout.getChildAt(1))
                              .setVisibility(View.VISIBLE);
                      // setting the Tour Amount
                      holder.amountButton.setText("$" +price);
                      //promoPlistPath.delete();
                  } else {
  
                      // Enabling the two buttons
                      holder.amountButton.setVisibility(View.VISIBLE);
                      // Setting the background color
                      holder.title
                              .setBackgroundColor(Color.parseColor("#993333"));
                      // Setting the Title color
                      holder.title.setTextColor(Color.WHITE);
                      // Centering the title
                      holder.title.setGravity(Gravity.LEFT);
                      // setting the city
                      ((TextView) holder.rlayout.getChildAt(1))
                              .setText(RaconTours.city);
                      ((TextView) holder.rlayout.getChildAt(1))
                              .setVisibility(View.VISIBLE);
                      // setting the Tour Amount
                      holder.amountButton.setText(TourDescription.currentTour
                              .getObjPrice());
  
                  }
              }
          } else {
              holder.amountButton.setVisibility(View.INVISIBLE);
              holder.pinButton.setVisibility(View.INVISIBLE);
              holder.arrowButton.setVisibility(View.INVISIBLE);
              holder.serialText.setVisibility(View.INVISIBLE);
              holder.title.setBackgroundColor(Color.WHITE);
              holder.title.setTextColor(Color.BLACK);
              holder.title.setGravity(Gravity.CENTER_HORIZONTAL);
              ((TextView) holder.rlayout.getChildAt(1))
                      .setVisibility(View.INVISIBLE);
          }
          return convertView;
      }
  
  
      @SuppressWarnings("unchecked")
      private void checkPromoCode(File promoPlistPath) {
          if (promoPlistPath.exists()) {
              try {
  
                  ObjectInputStream inStream = new ObjectInputStream(
                          new FileInputStream(promoPlistPath));
                  obj = (ArrayList&lt;HashMap&lt;String, Object&gt;&gt;) inStream
                          .readObject();
                  for (HashMap&lt;String, Object&gt; tmpObj : obj) {
                      promoTourname = (String) tmpObj.get("promoTour");
                      if (promoTourname.equals(TourDescription.currentTour.getObjtourName())) {
                          discountedTourDetails = tmpObj;
                          break;
                      }
                  }
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }
  
      class ViewHolder {
          Button pinButton;
          Button amountButton;
          RelativeLayout rlayout;
          TextView title;
          TextView desc;
          Button arrowButton;
          EditText serialText;
  
      }
  }
  </code></pre>
  
  <p>Here </p>
  
  <pre><code>    prodId = (String) discountedTourDetails.get("disProId");
  </code></pre>
  
  <p>I want to pass prodId to related activity.</p>
  
  <p>Note: Base Adapter is called from the activity </p>
  
  <pre><code>    adapter = new TourDescAdapter(currentTour.getListOfDescriptions(), this);
  
      setListAdapter(adapter);
  </code></pre>
  
  <p>Any one can tell me how to do this?</p>