Safcode Institute by Sir Safder





  • Simple List View

    
    public class MainActivity2 extends AppCompatActivity {
        ListView lview;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main2);
    
            lview = (ListView) findViewById(R.id.list);
    
            ArrayList obj = new ArrayList();
            obj.add("ABC");
            obj.add("12345");
            obj.add("XYZ");
    
            ArrayAdapter abc = new ArrayAdapter(getApplicationContext(),android.R.layout.simple_list_item_1,obj);
            lview.setAdapter(abc);
    
        }
    }



  • You Can Also Watch Our Tutorial