android - How to make a texField open with click of a button? -


i new android programming , there few things don't quite know how yet. doing course on udemy , trying put have learned point.
trying have user click on button (i have 12) , have bring textfield can enter 2 numbers. want able user's 2 numbers , i'm pretty sure can figure out rest ( hope). don't understand how go doing this. appreciated. want able have user click on 1 of 12 buttons , asked enter 2 values, take values , perform calculation on it.

your xml this:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical" >      <button android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:id="@+id/b_ok"         android:text="click me"/>      <edittext android:layout_width="fill_parent"         android:layout_height="match_parent"         android:visibility="invisible"         android:id="@+id/et_showme"/>  </linearlayout> 

and activity this:

package com.william.kinaan.welcomeback;  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 test1 extends activity implements onclicklistener {      private button b_ok;     private edittext et_showme;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.test1);         initialize();     }      private void initialize() {         this.b_ok = (button) findviewbyid(r.id.b_ok);         this.b_ok.setonclicklistener(this);         this.et_showme = (edittext) findviewbyid(r.id.et_showme);     }      @override     public void onclick(view v) {         this.et_showme.setvisibility(view.visible);     } } 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -