No resource identifier found for attribute ‘onClick’ in package ‘android’
<p>I am having the following error, when I am trying to run my code.</p>

<p>I googled it out. Many have talked about onclick method notbeing functional for API&lt;=3. I rechecked my API Level.It is 17.</p>

<p>How do I get about running my code.</p>

<p>If need I can post my MainActivity.java code to figure out.</p>

<p>here is the code</p>

<pre><code>package com.example.myfirstapp;




import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

public class MainActivity extends Activity {

private Button btn;
private EditText edit;
private Spinner spinner;
private TextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btn = (Button) findViewById(R.id.button);
    edit = (EditText) findViewById(R.id.edit_message);
    spinner = (Spinner) findViewById(R.id.spinner);
    textView = (TextView) findViewById(R.id.textView1);

    btn.setOnClickListener(
            new View.OnClickListener()
            {
                public void onClick(View view)
                {
                    //Log.v("EditText", edit.getText().toString());
                    //Log.v("Spinner", spinner.getSelectedItem().toString());
                    String url="http://js-server.xxx.edu:23405/examples/servlet/HelloWorldExample?title="+edit.getText().toString()+"&amp;type="+spinner.getSelectedItem().toString();
                    Log.v("url",url);
                }
            });



ArrayAdapter&lt;CharSequence&gt; adapter =      ArrayAdapter.createFromResource(this,R.array.title_type,android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

  //String url="http://js-server.xxx.edu:23405/examples/servlet/HelloWorldExample?title="+edit.getText().toString()+"&amp;type="+spinner.getSelectedItem().toString();
 // Log.v("url",url);

 spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) {
        //Object item = parent.getItemAtPosition(pos);

    }
    public void onNothingSelected(AdapterView&lt;?&gt; parent) {
    }
});


}

private class DownloadWebPageTask extends AsyncTask&lt;String, Void, String&gt; {
    @Override
    protected String doInBackground(String... urls) {
      String response = "";
      for (String url : urls) {
        DefaultHttpClient client = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(url);
        try {
          HttpResponse execute = client.execute(httpGet);
          InputStream content = execute.getEntity().getContent();

          BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
          String s = "";
          while ((s = buffer.readLine()) != null) {
            response += s;
          }

        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      return response;
    }

    @Override
    protected void onPostExecute(String result) {
      textView.setText(result);
    }
  }

  public void readWebpage(View view) {
    DownloadWebPageTask task = new DownloadWebPageTask();
    task.execute(new String[] { "http://js-server.xxx.edu:23405/examples/servlet/HelloWorldExample?title="+edit.getText().toString()+"&amp;type="+spinner.getSelectedItem().toString() });

  }
} 
</code></pre>

<p>All i am trying to do is to fetch the JSON data returned by the server. Then I need to parse the JSON data to form a tabular format. I am not onto this part yet, still stuck on retrieving the JSON data from my server.</p>

<p>My XML file is:</p>

<pre><code>&lt;LinearLayout 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:orientation="vertical" &gt;

&lt;EditText
    android:id="@+id/edit_message"
    android:layout_width="298dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="37dp"
    android:ems="10"
    android:hint="@string/edit_message" /&gt;

&lt;Spinner
    android:id="@+id/spinner"
    android:layout_width="304dp"
    android:layout_height="45dp" /&gt;

&lt;Button
    android:id="@+id/button"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="106dp"
    android:layout_height="wrap_content"
    android:onclick="readWebpage"
    android:text="@string/button_send" /&gt;

&lt;TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="Example Text" /&gt;

&lt;/LinearLayout&gt;
</code></pre>
