package com.checkedittextemptyornot_android_examples.com;

import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {

	EditText edittext;
	Button button;
	String GetEditText;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        button = (Button)findViewById(R.id.button1);
        edittext = (EditText)findViewById(R.id.editText1);
        
        button.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
				GetEditText = edittext.getText().toString();
				
				if(TextUtils.isEmpty(GetEditText)){
					
					Toast.makeText(MainActivity.this, "EditText is Empty", Toast.LENGTH_LONG).show();
					
				}
				else {
					
					Toast.makeText(MainActivity.this, "EditText is Not Empty", Toast.LENGTH_LONG).show();
					
				}
			}
		});
    }

}
