How to add clear button in android Studio.

 Hi guys we here providing our services to develop application.

the first of 

- you have to set your xml file and set i'd in button.

- And go to java file.


Code

clear.setOnClickListener(new Button.OnClickListener()

    {
        public void onClick
                (View v) {
            textview.setText("");
        }
    });

XML Code

<Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="34dp"
            android:layout_gravity="center"
            android:text="Clear"
            android:textSize="15sp"
            android:textStyle="italic"
            android:typeface="normal" />

Comments

Post a Comment

Popular posts from this blog

How to set Backpressed botton in android studio

how to set WebView in android studio