title: onclicklistener not working while using this code
body: <p>the <code>onclicklistener</code> is not at all working while clicking</p>
  
  <pre><code>public void adddata()
  {
      subbtn.setOnClickListener(new View.OnClickListener()
          {public void onClick(View v) {
              Date d = new Date(); 
              CharSequence s = DateFormat.format("MMMM d, yyyy ", d.getTime());
              int total = Integer.parseInt(String.valueOf(foodtext.getText())) + Integer.parseInt(petroltext.getText().toString()) + Integer.parseInt(grocetext.getText().toString()) +
                      Integer.parseInt(sundrytext.getText().toString()) + Integer.parseInt(educatext.getText().toString()) + Integer.parseInt(loantext.getText().toString());
              System.out.println(total);
              boolean inserted = dbex.insertdata(Integer.parseInt(s.toString()), Integer.parseInt(foodtext.getText().toString()), Integer.parseInt(petroltext.getText().toString()), Integer.parseInt(grocetext.getText().toString()),
                      Integer.parseInt(sundrytext.getText().toString()), Integer.parseInt(educatext.getText().toString()), Integer.parseInt(loantext.getText().toString()), total);
              if (inserted)
                     Toast.makeText(todayex.this, "datainserted", Toast.LENGTH_LONG).show();
  
  
              else
                  Toast.makeText(todayex.this, "datanotinserted", Toast.LENGTH_LONG).show();
          }});
          startActivity(intent);
  
      }
  }
  </code></pre>
  
  <p>while clicking that button it needs to open new activity as well should store my data into database</p>