Android Studio: ListView lagi
Revision as of 13:49, 6 March 2022 by Onnowpurbo (talk | contribs) (Created page with " ==ListDisplay.java== package com.example.ListDisplay; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAd...")
ListDisplay.java
package com.example.ListDisplay; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.ListView; public class ListDisplay extends Activity { // Array of strings... String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry", "WebOS","Ubuntu","Windows7","Max OS X"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.activity_listview, mobileArray); ListView listView = (ListView) findViewById(R.id.mobile_list); listView.setAdapter(adapter); } }