0

How to add border on Layouts in Android

[code langauage=”xml”] <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#33ffffff" /> <solid android:color="#33ffffff" /> </shape> </item> <item android:top="1dp" android:bottom="1dp"> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#33ffffff" /> <solid android:color="#33ffffff" /> </shape> </item> </layer-list> [/code] then add this to… Continue Reading

0

Edit Text Validation In Android Example ~ Codeofsandy

Today i am going to share Android Validation on EditText setError() is used to show the error. main.xml [code language=”css”] <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> <EditText android:layout_height="wrap_content" android:id="@+id/editText1" android:layout_width="fill_parent"> </EditText> <Button android:layout_height="wrap_content" android:id="@+id/button1" android:text="Check" android:layout_width="wrap_content" android:onClick="btnClick">… Continue Reading

0

Get Value of a Edit Text field in Android

XML Button Code [code language=”css”] <EditText android:id="@+id/name" android:width="250px" /> [/code] Java Code to get the value of Edit Text [code language=”css”] down vote accepted By using getText(): Button mButton; EditText mEdit; /** Called when the activity is first created. */… Continue Reading

0

Android Radio Button and Radio Group Example Code

main.xml [code language=”css”] <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:textSize="20dp" android:textStyle="bold" android:textColor="#fff" android:layout_width="wrap_content" android:layout_gravity="center_horizontal" android:id="@+id/textView1" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:text="How was today’s tutorial ?"></TextView> <RadioGroup android:layout_width="wrap_content" android:layout_gravity="center_horizontal" android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/rgOpinion"> <RadioButton android:layout_width="wrap_content" android:id="@+id/radio0" android:layout_height="wrap_content" android:checked="true" android:text="Excellent"></RadioButton> <RadioButton android:id="@+id/radioButton1"… Continue Reading

0

Get CheckBox value in Android Java Code

//MainActivity.java [code language=”css”] package codeof.sandy; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; public class MainActivity extends Activity { CheckBox chkfair, chkgood, chkgreat, chkexcellent @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("CheckBoxActivity"); setContentView(R.layout.main); find_and_modify_text_view(); } private void find_and_modify_text_view()… Continue Reading