title: Toast.makeText doesn't work
body: <p>I have a problem with fragment.... When I click on button to call <code>showResult</code> method, <code>Toast.makeText</code> doesn't show me the name of selected checkbox.</p>
  
  <p>I don't know why. </p>
  
  <pre><code>public class MyListFragment extends Fragment implements
          android.widget.CompoundButton.OnCheckedChangeListener {
  
      ListView lv;
      ArrayList&lt;Planet&gt; planetList;
      PlanetAdapter plAdapter;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_list2, container, false);
          Button mButton = (Button) rootView.findViewById(R.id.button);
          mButton.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
              showResult(v);
              }
          });
          //return inflater.inflate(R.layout.fragment_list2, container, false);
          return  rootView;
      }
  
  
      @Override
      public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
  
          lv = (ListView)getView().findViewById(R.id.listview);
          displayPlanetList();
      }
  
      private void displayPlanetList() {
  
          planetList = new ArrayList&lt;Planet&gt;();
          planetList.add(new Planet("Margherita", 6, "€"));
          planetList.add(new Planet("Diavola", 7,"€"));
          planetList.add(new Planet("Bufalina", 5,"€"));
          planetList.add(new Planet("Marinara", 5,"€"));
          planetList.add(new Planet("Viennese", 4,"€"));
  
          plAdapter = new PlanetAdapter(planetList, getContext());
          lv.setAdapter(plAdapter);
      }
  
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  
          int pos = lv.getPositionForView(buttonView);
          if (pos != ListView.INVALID_POSITION) {
              Planet p = planetList.get(pos);
              p.setSelected(isChecked);        
  
          /*Toast.makeText(
                  getActivity(),
                  "Clicked on Planet: " + p.getName() + ". State: is "
                          + isChecked, Toast.LENGTH_SHORT).show();*/
          }    
      }    
  
      public void showResult(View v) {
          String result = "Selected Product are :";
          int totalAmount=0;
  
          for (Planet p : plAdapter.getBox()) {
              if (p.selected){
                  System.out.println("pizza selezionata: " + p.name);
  
                      System.out.println("nessuna pizza selezionata: ");
  
                  result += "\n" + p.name+" "+p.distance+"€"+"q.tà :"+p.getQuantità();
                  //if (p.quantità.equals("") &amp;&amp; p.quantità.equals(null) ){
                  System.out.println("leggo questo record:"+p.name + " " + p.distance + " " + p.quantità );
  
                  System.out.println("leggo questo p.getquatità :"+p.quantità );
                  //}
                  //else{
                  System.out.println("leggo questo in p.quantità: " + p.getQuantità());
                  int quantitaInt= Integer.parseInt(p.getQuantità() );
                  totalAmount+=p.distance * quantitaInt;
  
                  //}
              }
  
          }
        Toast.makeText(getActivity(), result+"\n"+"Total Amount:="+totalAmount, Toast.LENGTH_LONG).show();
          System.out.println("leggo result e total amount: " + result + " " + totalAmount);
  
  
          //Integer.toString(totalAmount);
      //  Intent i = new Intent(getActivity(), TwoFragment.class);
          /*i.putExtra("NomeDati1", result);
          i.putExtra("NomeDati2", String.valueOf(totalAmount));
          startActivity(i);
  */    
      }    
  }
  </code></pre>
  
  <p>THIS IS MAIN</p>
  
  <pre><code>public class Main extends AppCompatActivity  {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.fragmentContainer, new MyListFragment())
            .commit();
      }
  }
  
  class Planet {
  
      String name;
      int distance;
      String quantità;
      String valuta;
      boolean selected = false;
  
  
  
      public Planet(String name, int distance, String valuta) {
          super();
          this.name = name;
          this.distance = distance;
          this.valuta = valuta;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public int getDistance() {
          return distance;
      }
  
      public void setDistance(int distance) {
          this.distance = distance;
      }
  
      public boolean isSelected() {
          return selected;
      }
  
      public void setSelected(boolean selected) {
          this.selected = selected;
      }
  
      public String getQuantità() {
          return quantità;
      }
  
      public void setQuantità(String quantità) {
          this.quantità = quantità;
      }
      public String getValuta() {
          return valuta;
      }
  
      public void setValuta(String valuta) {
          this.valuta = valuta;
      }
  
  }
  
    class PlanetAdapter extends ArrayAdapter&lt;Planet&gt; implements CompoundButton.OnCheckedChangeListener
  
  {
  
      private List&lt;Planet&gt; planetList;
      private Context context;
      ArrayList&lt;Planet&gt; objects;
  
  
      public  PlanetAdapter(List&lt;Planet&gt; planetList, Context context) {
          super(context, R.layout.single_listview_item, planetList);
          this.planetList = planetList;
          this.context = context;
      }
  
      @Override
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  
      }
  
  
      public  class PlanetHolder  {
          public TextView planetName;
          public TextView distView;
          public TextView valuta;
          public CheckBox chkBox;
          public EditText edit;
          public String quantità;
  
  
  
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
  View row = convertView;
          PlanetHolder holder = null;
          if (row == null) {
              LayoutInflater inflater = ((Activity) context).getLayoutInflater();
              row = inflater.inflate(R.layout.single_listview_item, parent, false);
              holder = new PlanetHolder();
              holder.planetName = (TextView) row.findViewById(R.id.name);
              holder.distView = (TextView) row.findViewById(R.id.dist);
              holder.valuta = (TextView) row.findViewById(R.id.valuta);
              holder.chkBox = (CheckBox) row.findViewById(R.id.chk_box);
              holder.edit = (EditText) row.findViewById(R.id.editText);
              holder.edit.setVisibility(View.GONE);
              holder.edit.setEnabled(false);
              row.setTag(holder);
          } else {
              holder = (PlanetHolder) row.getTag();
          }
          final Planet p = planetList.get(position);
  
          holder.chkBox.setOnCheckedChangeListener(PlanetAdapter.this);
          final PlanetHolder finalHolder = holder;
          holder.chkBox.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if (finalHolder.chkBox.isChecked()) {
                      finalHolder.edit.setVisibility(View.VISIBLE);
                      finalHolder.edit.setEnabled(true);
                      finalHolder.edit.addTextChangedListener(new TextWatcher() {
                          @Override
                          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                          }
  
                          @Override
                          public void onTextChanged(CharSequence s, int start, int before, int count) {
                          }
  
                          @Override
                          public void afterTextChanged(Editable s) {
                              p.setQuantità(finalHolder.edit.getText().toString().trim());
                              System.out.println(finalHolder.edit.getText().toString().trim());
                          }
                      });
                  } else {
                      finalHolder.edit.setVisibility(View.GONE);
                      finalHolder.edit.setEnabled(false);
                      finalHolder.edit.setText(null);
                  }
              }
          });
          holder.planetName.setText(p.getName());
          holder.distView.setText("" + p.getDistance());
          holder.valuta.setText(""+p.getValuta());
          holder.chkBox.setChecked(p.isSelected());
          holder.chkBox.setTag(p);
          holder.edit.setEnabled(false);
  
          return row;
      }
  
  
      ArrayList&lt;Planet&gt; getBox() {
          ArrayList&lt;Planet&gt; box = new ArrayList&lt;Planet&gt;();
          for (Planet p : planetList) {
              if (p.selected)
                  box.add(p);
          }
          return box;
      }
  
  
  }
  </code></pre>