title: GridView.FATAL EXCEPTION: main android.content.res.Resources$NotFoundException: String resource ID #0x0
body: <p>I want that when I click on an element of GridView displayed letter, which I clicked. But initially I got here error when I wanted to take the position of the element. If I understood correctly, gridview does not see the textview, but i don't know why.</p>
  
  <p>Error:</p>
  
  <pre><code>5312-5312/standandroid.ru.words E/AndroidRuntime﹕ FATAL EXCEPTION: main
  android.content.res.Resources$NotFoundException: String resource ID #0x0
          at android.content.res.Resources.getText(Resources.java:240)
          at android.content.res.MiuiResources.getText(MiuiResources.java:131)
          at android.widget.Toast.makeText(Toast.java:273)
          at standandroid.ru.words.MainActivity$1$1.onItemClick(MainActivity.java:70)
          at android.widget.AdapterView.performItemClick(AdapterView.java:298)
          at android.widget.AbsListView.performItemClick(AbsListView.java:1130)
          at android.widget.AbsListView$PerformClick.run(AbsListView.java:2818)
          at android.widget.AbsListView$1.run(AbsListView.java:3498)
          at android.os.Handler.handleCallback(Handler.java:730)
          at android.os.Handler.dispatchMessage(Handler.java:92)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:5137)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:525)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:756)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:572)
          at miui.dexspy.DexspyInstaller.main(DexspyInstaller.java:171)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>MainActivity.java :</p>
  
  <pre><code>public class MainActivity extends Activity {
  TextView txt, textTV;
  EditText etxt;
  Button btn;
  ArrayAdapter&lt;String&gt; adapter;
  GridView gridView;
  String name;
  
  char c;
  ArrayList arrayList=new ArrayList();
  
  int i;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      txt = (TextView) findViewById(R.id.textView);
      etxt = (EditText) findViewById(R.id.editText);
      btn = (Button) findViewById(R.id.button);
      textTV = (TextView) findViewById(R.id.tv);
  
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              name = etxt.getText().toString();
              TreeSet list = new TreeSet();
              for (i = 0; i &lt; name.length(); i++) {
                  c = name.charAt(i);
                  list.add(c);
  
              }
               arrayList = new ArrayList(list);
  
              adapter = new ArrayAdapter&lt;String&gt;(MainActivity.this, R.layout.item, R.id.tv, arrayList);
              gridView = (GridView) findViewById(R.id.gridmain);
              gridView.setAdapter(adapter);
              ViewGrid();
              gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                      Toast.makeText(MainActivity.this, position,Toast.LENGTH_LONG).show();
                  }
              });
          }
  
      });}
    private void ViewGrid(){
      gridView.setNumColumns(4);
      gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); }}
  </code></pre>
  
  <p>activity_main.xml: </p>
  
  <pre><code>&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:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:paddingBottom="@dimen/activity_vertical_margin"
  tools:context=".MainActivity"&gt;
  
  
  
   &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:id="@+id/textView"
      android:layout_alignParentBottom="true"
      android:layout_centerHorizontal="true"
      android:layout_marginBottom="175dp" /&gt;
  
  &lt;EditText
  
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/editText"
      android:singleLine="true"
      android:layout_alignParentTop="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:layout_marginTop="48dp" /&gt;
  
   &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="New Button"
      android:id="@+id/button"
      android:layout_below="@+id/editText"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="44dp" /&gt;
   &lt;GridView
      android:id="@+id/gridmain"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="44dp"
      android:layout_alignTop="@+id/textView"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"&gt;&lt;/GridView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>item.xml: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;TextView
      android:id="@+id/tv"
      android:textSize="40sp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/j5S93.png" rel="nofollow">http://i.stack.imgur.com/j5S93.png</a></p>