How do I make a button invisible and when I need it I set the text of the button. Heres the code I tried,This is the MainActivity.class.
getSupportActionBar().hide();
phno=(EditText)findViewById(R.id.editText3);
}
public void get(View view){
String ph=phno.getText().toString();
Button btn=(Button)findViewById(R.id.button3);
btn.setText("Call"+ph);
btn.setTextSize(30);
}
Here's the xml folder:
EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="@+id/editText3"
android:layout_marginTop="119dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:hint="Enter Phone Number"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok"
android:id="@+id/button2"
android:layout_centerVertical="true"
android:layout_alignRight="@+id/editText3"
android:layout_alignEnd="@+id/editText3"
android:onClick="get"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button3"
android:layout_alignTop="@+id/button2"
android:layout_alignLeft="@+id/editText3"
android:layout_alignStart="@+id/editText3"
android:visibility="gone"
/>
When I enter the number and click Ok, nothing happens. Please help,