Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think there's a good way to do it with strings like "r1c1", "r1c2" etc, but there are a couple of options:</p> <p>If you just need to get a valid id, you could use the static method <code>View.generateViewId()</code>. This is API level 17 though, so will only work in recent versions of Android. See here: <br> <a href="http://developer.android.com/reference/android/view/View.html#generateViewId%28%29" rel="nofollow">http://developer.android.com/reference/android/view/View.html#generateViewId%28%29</a></p> <p>An alternative would be to store references to the <code>EditText</code> objects in a two-dimensional array or list. When you need to sum up rows or columns, you'd iterate over the appropriate section of the array and go from there.</p> <p>A third option would be to keep a two-dimensional array of values from each <code>EditText</code> instead of the <code>EditText</code> itself. You could do this with a <code>TextWatcher</code> like this:</p> <pre><code>// Creating EditText for (row,col) // Expand size of 2D array if necessary EditText cb = new EditText(this); cb.setLayoutParams(params); cb.setBackgroundColor(Color.parseColor("#ffffff")); cb.setInputType(InputType.TYPE_CLASS_NUMBER); // So the user can only enter numbers cb.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { mValues[row][col] = Integer.valueOf(s.toString()); } }); </code></pre> <p>See these links for more details:<br> <a href="https://developer.android.com/reference/android/widget/TextView.html#addTextChangedListener%28android.text.TextWatcher%29" rel="nofollow">https://developer.android.com/reference/android/widget/TextView.html#addTextChangedListener%28android.text.TextWatcher%29</a><br> <a href="https://developer.android.com/reference/android/text/TextWatcher.html" rel="nofollow">https://developer.android.com/reference/android/text/TextWatcher.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload