Exp No 14
Exp No 14
Exp No 14
14
XML CODE
<LinearLayout @Override
xmlns:android="http://schemas.android.com/a
protected void onCreate(Bundle
pk/res/android"
savedInstanceState) {
android:layout_width="match_parent"
super.onCreate(savedInstanceState);
android:layout_height="match_parent"
setContentView(R.layout.activity_main);
android:orientation="vertical">
String[]items =new
<ListView String[]{"Android","Java","PFP","Hadoop","SAP"
,"Python","AJAX","C++","Ruby","Rails"};
android:id="@+id/list_view"
ArrayAdapter<String> adapter = new
android:layout_width="match_parent"
ArrayAdapter<String>(this,
android:layout_height="match_parent" android.R.layout.simple_list_item_1, items);
listview.setOnItemClickListener(new
JAVA CODE AdapterView.OnItemClickListener() {
package com.example.exp14; @Override
import android.annotation.SuppressLint; public void onItemClick(AdapterView<?>
import android.os.Bundle; adapterView, View view, int position, long id) {
import android.widget.Toast; }
import });
androidx.appcompat.app.AppCompatActivity; }
public class MainActivity extends }
AppCompatActivity {