trouble with code to change the state of my Edittext when using soft keyboard
<p>I have my editText set to height and width of 0dp with this code :</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:paddingBottom="0dp"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    tools:context=".MainActivity"&gt;

    &lt;ListView android:id="@+id/ListView_CallData"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_weight="1"&gt;
    &lt;/ListView&gt;

    &lt;EditText
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:id="@+id/editText"
        android:background="@null"
        android:inputType="phone"&gt;
    &lt;!--android:visibility="invisible"--&gt;
    &lt;/EditText&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>What I want is the size of the editText to change (the user only sees it when they start to type using the softKeyBoard) but it always stays invisible ; that is, 0 height and 0 width. Here's the code in my MainAcitivity.java.</p>

<p>You will find what I believe is the relevant code between the </p>

<pre><code>//RELEVANT CODE STARTS HERE!!!!!!!!!!!!!!!!!
</code></pre>

<p>comments, but I'm posting all the code in case it's having some impact I don't know about.</p>

<p>I also tried using <code>getLayoutParams</code> but that didn't work either. Thanks for any help.</p>

<pre><code>package com.example.chris.sunil_gupta;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CallLog;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ListView;

public class MainActivity extends Activity {

//ArrayList is an implementation of List.
//ArrayList provides a resizable-array, which means that items can be added and removed from the list. An ArrayList is a
// dynamic data structure so it can be used when there is no upper bound on the number of elements, ideal for the Call
// history. From the other side, a simple Array in java is a static data structure, because the initial size of array cannot be
// changed, so it can be used only when the data has a known number of elements.

//We are making a list called listofphonehistory and we are using CallData as the datasource

    private List&lt;CallData&gt; listofphonehistory = new ArrayList&lt;CallData&gt;();

    //    Context is an abstract class...which means what exactly?
    private Context context = null;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

//create a ListView object called listview
        ListView listview;

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        context = this;

//initialise the object called listview, it's a ListView object and the exact id it will appear in is called ListView_CallData
        listview = (ListView) findViewById(R.id.ListView_CallData);

//        call the function getCallDetails which will sort our number, name, call date, call type, duration
        getCallDetails();

//CustomAdapter is the class we are going to use. We will use it to create CustomAdapter
//objects which will appear in the MainActivity activity, using the listofphonehistory
        CustomAdapter adapter = new CustomAdapter(MainActivity.this, listofphonehistory);
        listview.setAdapter(adapter);

//        //RELEVANT CODE STARTS HERE!!!!!!!!!!!!!!!!!

        //    This ensures that the editText textbox will have the focus when the activity loads
        // so that our soft keyboard pops up. editText is set to 0dp in width and height,
        //so the user can't see it unless they need to use it. When the user starts typing
        //with the keyboard then the width and height will be bigger and they can see it.
        final EditText editText = (EditText) findViewById(R.id.editText);
        editText.requestFocus();

        editText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {

        if (editText.length() &gt; 0) {

            //Your query to fetch Data
//            editText.getLayoutParams().width=32;
//            editText.getLayoutParams().height=50;
            editText.setWidth(32);
            editText.setHeight(50);
        }
            }
        });

        //RELEVANT CODE ENDS HERE!!!!!!!!!!!!!!!!!

    }

    public void getCallDetails() {


        //        cursor1 gets all the items in the calllog and arranges them from newest call down
        Cursor cursor1 = getContentResolver().query(
                CallLog.Calls.CONTENT_URI, null, null, null, CallLog.Calls.DATE + " DESC");

//looks like all the cell values in the calllog database are integers
        int number = cursor1.getColumnIndex(CallLog.Calls.NUMBER);
        int type = cursor1.getColumnIndex(CallLog.Calls.TYPE);
        int date = cursor1.getColumnIndex(CallLog.Calls.DATE);
        int duration = cursor1.getColumnIndex(CallLog.Calls.DURATION);

        int name = cursor1.getColumnIndex(CallLog.Calls.CACHED_NAME);

//declare some new variables here; we're going to convert the integers into these
        int callType;
        String phoneNumber;
        String callDate;
        String callDuration;
        Date callDateTime;

        String cachedName;


        while (cursor1.moveToNext()) {
//        go through all the rows in the db and convert the values to strings or whatever
//        It's important that these are inside the while loop. Otherwise it will try to read
//        the value of a column while the cursor is at an invalid position (-1) because moveToNext()
//        hasn't been called yet.

            callType = cursor1.getInt(type);
            phoneNumber = cursor1.getString(number);
            callDate = cursor1.getString(date);
            callDateTime = new Date(Long.valueOf(callDate));
            callDuration = cursor1.getString(duration);

            cachedName = cursor1.getString(name);


// If the contact has a name, then show the name in the calllog instead of the number
            if (cachedName != null) {
                phoneNumber = cachedName;
            } else {
                phoneNumber = phoneNumber;
            }

//            the string cType will give us text of either outgoing, incoming or missed calls
            String cType = null;


//          callType will either be 1,2 or 3
            switch (callType) {
                case CallLog.Calls.OUTGOING_TYPE:
                    cType = "OUTGOING";
                    break;

                case CallLog.Calls.INCOMING_TYPE:
                    cType = "INCOMING";
                    break;

                case CallLog.Calls.MISSED_TYPE:
                    cType = "MISSED";
                    break;
            }
//          CallData is a constructor
//            We are passing the values cType, phoneNumber, callDateTime and callDuration, in the While Loop of above,
//              to the CallData object and this will show us calltype, callnumber, calldatetime and callduration in our cells.
            CallData calldata = new CallData(cType, phoneNumber, callDateTime, callDuration);
//            add new call data info to the list, moving on down through the values in Calllog
            listofphonehistory.add(calldata);
        }

        cursor1.close();
    }


}
</code></pre>