-1

I am making an android app. In order to process user input I'm using onStart() to check for input and then, I call another activity using a button.

protected void onStart()
{
    Button searchrestrauntbutton = (Button)findViewById(R.id.search);
    searchrestrauntbutton.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v)
        {
            EditText area = (EditText)findViewById(R.id.area);
            EditText locality = (EditText)findViewById(R.id.locality);
            String area1 = area.getText().toString();
            String locality1 = locality.getText().toString();
            if(area1.equals(""))
            {
                area.setError("please enter an area");
            }
            else if(locality1.equals(""))
            {
                locality.setError("please provide locality");
            }
            else
            {
                Intent intentsearch = new Intent(HomePage.this,displayrestraunt.class);
                startActivity(intentsearch);
            }
        }
    });
}
hcerim
  • 959
  • 1
  • 11
  • 27
  • 2
    Use LogCat to examine the Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare Jan 07 '17 at 21:35

1 Answers1

1

you are missing a call to super.onStart() method

check out the activity docs

Zeeshan Khan
  • 53
  • 1
  • 7