Answer the question
In order to leave comments, you need to log in
How to get all TextView on screen?
ArrayAdapter forms a ListView, each of whose elements contains two TextView :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:id="@+id/card"
android:layout_height="match_parent"
android:background="@drawable/border"
android:gravity="center_vertical"
android:paddingTop="50dp">
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginLeft="50dp" />
<TextView
android:id="@+id/content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_marginLeft="50dp" />
</LinearLayout>
public class CardsDataAdapter extends ArrayAdapter<Card> {
@Override
public View getView(int position, final View contentView, ViewGroup parent){
Card card = getItem(position);
TextView v1 = (TextView) contentView.findViewById(R.id.content);
v1.setText(card.word);
TextView v2 = (TextView) contentView.findViewById(R.id.content2);
v2.setText(card.translate);
return contentView;
}
}
TextView v2 = (TextView) contentView.findViewById(R.id.content2);
v2.setText(card.translate);
v2.setTag(String.valueOf(position));
//****************************//
findViewWithTag(String.valueOf(1)) // тут все рушится
Answer the question
In order to leave comments, you need to log in
You apparently misunderstand how to work with ListView. You do not, under any circumstances, need an array of these TextViews. Tell me what you want to do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question