Fristly I am very new to android and I have two android:id .
For example: [ R.id.custom_font ] and [ R.id.product_name ]
In .java file
TextView tv = (TextView)findViewById(R.id.custom_font);
Typeface cFont = Typeface.createFromAsset(getAssets(), "fonts/jcc.ttf");
tv.setTypeface(cFont);
adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.product_name, R.id.custom_font, products);
lv.setAdapter(adapter);
When I put them together in a single text view it shows an error message [Attribute “android:id” was already specified for element “TextView”]
In .xml file
<TextView
android:textColor="?android:textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/custom_font"
android:id="@+id/product_name" //Attribute "android:id" was already specified for element "TextView"
android:textSize="15sp" />
How can I pass the two android:id in a single text view?
Or anybody if kindly help me Download This
Thanks in advance.
You can only set one Id to an UI widget. Remove one of the Id’s. You can use the same Id for your ArrayAdapter.