हाय मैं एंड्रॉइड में नया हूं। किसी को भी मुझे बता सकते हैं pls क्या निम्नलिखित कोड के साथ गलत:प्रोग्राम व्यू बनाएं प्रोग्रामेटिक
public class ListApp extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView lText = new TextView(this);
lText.setId(0);
ListView lView = new ListView(this);
String[] lStr = new String[]{"AA","BB", "CC"};
ArrayAdapter lAdap = new ArrayAdapter(this,lText.getId(),lStr);
lView.setAdapter(lAdap);
lView.setFocusableInTouchMode(true);
setContentView(lView);
}
}
एक चीज़ के लिए, आप गलत तरीके से ArrayAdapter कन्स्ट्रक्टर का उपयोग कर रहे हैं। आप दो पैरामीटर संस्करण का उपयोग करना चाहते हैं: (संदर्भ संदर्भ, int textViewResourceId) – moonlightcheese
इस तरह: ArrayAdapter lAdap = new ArrayAdapter (यह, lText.getId()); –
moonlightcheese