title: How to change text from Android ListView?
body: <p>When I click on item 0(Bacon) then app close.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          ListView buckyListView = (ListView) findViewById(R.id.buckyListView);
          String[] foods = {"Bacon", "Tuna", "Ham", "Bucky", "Tommy", "Sunny", "Mommy", "Burger", "Pizza", "HotDog", "Muniraka", "Mouse", "Keyboard", "Tenda", "Iron", "Public", "Life", "Good", "Keyboard", "PenDrive", "RedFort"};
  
          ListAdapter buckysAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1, foods);
  
          buckyListView.setAdapter(buckysAdapter);
  
          buckyListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  switch(position) {
                      case 0:
                          TextView tv = (TextView) view.findViewById(R.id.textView);
                          tv.setText("TextView was Clicked");
                          break;
                      default:
                          break;
                  }
              }
          });
      }
  }
  </code></pre>
  
  <p>How to change text when i click on item? I am using latest version of android studio and I have to build this project on API 15.</p>
  
  <pre><code>08-03 10:35:46.037 707-997/? E/MountService: Failed to read response to volume shared /storage/emulated/0 ums
  08-03 10:35:46.203 707-3517/? E/MountService: Failed to read response to volume shared /storage/emulated/0 ums
  08-03 10:35:46.339 707-997/? E/MountService: mount service registerListener=android.os.storage.IMountServiceListener$Stub$Proxy@42f00498
  08-03 10:35:46.339 707-853/? E/MountService: Failed to read response to volume shared /storage/emulated/0 ums
  08-03 10:37:34.868 707-717/? E/Sensors: new acc setDelay handle(0),ns(20000000) err! go to hwmsen
  08-03 10:38:37.970 7618-7618/? E/dalvikvm: /system/framework/mediatek-op.jar odex has stale dependencies
  08-03 10:38:38.000 7618-7618/? E/dalvikvm: /system/framework/am.jar odex has stale dependencies
  08-03 10:38:38.004 7618-7618/? E/cutils-trace: Error opening trace file: No such file or directory (2)
  08-03 10:38:38.174 7618-7618/? E/memtrack: Couldn't load memtrack module (No such file or directory)
  08-03 10:38:38.174 7618-7618/? E/android.os.Debug: failed to load memtrack module: -2
  08-03 10:38:38.411 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.412 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.412 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.412 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.widget.Toolbar', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.414 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.app.ActivityManager$TaskDescription', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.416 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.416 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.418 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.423 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.app.assist.AssistContent', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.425 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.view.SearchEvent', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:38.427 7634-7634/com.example.android.bucky45 E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.example.android.bucky45.MainActivity.access$super
  08-03 10:38:54.435 7634-7634/com.example.android.bucky45 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                         Process: com.example.android.bucky45, PID: 7634
                                                                         java.lang.NullPointerException
                                                                             at com.example.android.bucky45.MainActivity$1.onItemClick(MainActivity.java:37)
                                                                             at android.widget.AdapterView.performItemClick(AdapterView.java:299)
                                                                             at android.widget.AbsListView.performItemClick(AbsListView.java:1152)
                                                                             at android.widget.AbsListView$PerformClick.run(AbsListView.java:3014)
                                                                             at android.widget.AbsListView$3.run(AbsListView.java:3865)
                                                                             at android.os.Handler.handleCallback(Handler.java:808)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:103)
                                                                             at android.os.Looper.loop(Looper.java:193)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5345)
                                                                             at java.lang.reflect.Method.invokeNative(Native Method)
                                                                             at java.lang.reflect.Method.invoke(Method.java:515)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
                                                                             at dalvik.system.NativeStart.main(Native Method)
  08-03 10:41:35.160 707-717/? E/Sensors: new acc setDelay handle(0),ns(20000000) err! go to hwmsen
  08-03 10:41:57.947 7720-7720/? E/lcdc_cap: [DDMSCap]pmem_alloc size = 0x00384020, addr = 0xb6ad8008
  08-03 10:43:28.480 7729-7729/? E/dalvikvm: Could not find class 'com.google.android.apps.gsa.assist.GsaVoiceInteractionSession', referenced from method com.google.android.apps.gsa.assist.GsaVoiceInteractionSession_MembersInjector.au
  08-03 10:43:28.499 7729-7729/? E/dalvikvm: Could not find class 'com.google.android.apps.gsa.tasks.VelvetBackgroundTasksJobService', referenced from method com.google.android.apps.gsa.tasks.l.au
  08-03 10:43:28.522 945-1860/? E/ctxmgr: [AppIntervalImpl]closeInterval: ongoing
  08-03 10:43:28.726 7729-7750/? E/dalvikvm: Could not find class 'android.content.pm.LauncherApps', referenced from method com.google.android.apps.gsa.search.shared.multiuser.l.connect
  08-03 10:43:29.234 7729-7729/? E/CardSyncManagerImpl: onConnectionFailed: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
  08-03 10:43:29.234 7729-7760/? E/CardSyncManagerImpl: Failed to connect to GoogleApiClient: null
  08-03 10:43:29.416 7729-7763/? E/dalvikvm: Could not find class 'android.content.pm.LauncherApps', referenced from method com.google.android.apps.gsa.shared.s.a.a.n
  08-03 10:43:29.587 7729-7729/? E/dalvikvm: Could not find class 'org.chromium.net.s', referenced from method org.chromium.net.NetworkChangeNotifierAutoDetect.&lt;init&gt;
  08-03 10:43:30.616 7729-7764/? E/GeofenceHelper: Failed: remove geofences by PendingIntent
  </code></pre>
  
  <p>This layout xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
  android:layout_height="match_parent"   
  
   android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
   android:paddingTop="@dimen/activity_vertical_margin"
   tools:context="com.example.android.bucky45.MainActivity"&gt;
  
  &lt;ListView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/buckyListView"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_marginTop="147dp"&gt;&lt;/ListView&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="Large Text"
      android:id="@+id/textView"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="48dp" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>check this code and please correct this It is really very Important</p>