Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That's because <em>findViewById</em> called on a view looks for the child view of the given view. </p> <p><a href="http://developer.android.com/reference/android/view/View.html#findViewById%28int%29" rel="nofollow">findViewById doc</a></p> <p>"Look for a child view with the given id. If this view has the given id, return this view."</p> <p>From what I can see, CBV_textview2 is contained in the layout of the activity. So, what you can do is to pass the activity to the adapter's constructor (I see you already have a _c member variable which I suppose is a Context, OR directly pass the CBV_textview2 itself (calling findViewById in the containing activty).</p> <p>In both cases, you need to call the activity's findViewById which "Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle)."</p> <pre><code>public class YourAdapter extends ArrayAdapter&lt;String&gt; { private final Context context; // blahblahblah private final TextView mYourTextView; public YourAdapter(Context context, String[] values, TextView btnUpdate) { super(context, R.layout.rowlayout, values); this.context = context; this.values = values; mYourTextView = btnUpdate; } .... @Override public void onClick(View v) { Toast.makeText(_c, "clicked quick add "+p, Toast.LENGTH_SHORT).show(); //mYourTextView.setTag(1); //mYourTextView.setText(btnUpdate.getTag().toString()); mYourTextView.setText("b"); } </code></pre> <p>In your activity you should be able to get the TextView before calling the constructor. </p>
 

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