Tag Archives: getText

How to show error in an EditText using setError() in Android?

By | September 18, 2012

We will go straight to the code. [java] package com.coderzheaven.seterror; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn =(Button)findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { EditText edittext =(EditText)findViewById(R.id.editText1); if(edittext.getText().length()==0){ edittext.setError("Field cannot be left blank."); }… Read More »

How to show a sliding window from below in Android?

By | December 22, 2011

Hello everyone, I have already showed you how to use a SlidingViewer to create a slidingWindow. Today I will show another way to create such a window with the help of animation. Please check one of my previous posts to do this in another way. How to show a sliding window from below in Android? Check this new… Read More »

SlidingDrawer in Android, A simple example.

By | December 1, 2011

Sliding-Drawer in a nice and useful widget in android. Please check one of my previous posts to do this in another way. How to show a sliding window from below in Android? Check this new One using Navigation Drawer About Sliding drawer SlidingDrawer hides content out of the screen and allows the user to drag a handle to… Read More »

Email validation in ANDROID.

By | May 1, 2011

This is a simple example showing email validation in ANDROID. This example uses regex for email validation. Create a button and an edittext in your main.xml file and try this code. [java] package com.coderzheaven; import java.util.regex.Pattern; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class EmailValidationDemo extends… Read More »