Category Archives: EditText

How to find your Google Plus ID

By | September 27, 2012

This is so simple 1. Go to your Google + account (https://plus.google.com/). 2. Click on the Profile icon on the Left. 3. If you look at the URL in the address bar, it should look something like this: https://plus.google.com/104653270154306099169/posts 4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven’s from the URL above:… Read More »

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 »