user1106352
user1106352

Reputation:

Getting View cannot be resolved to a type error on function

I am new to Android/java programming. I really have no clue what I am doing, and would like a little help. What I am trying to do is build a form very similar to the one below. I have already put in all of the layout, and strings information, but I am having trouble with the functions. The error that I am getting is View cannot be resolved to a type line 14. I am using eclipse to help me program this app. Here is my main.xml, and MadisonStudios.java file's contents as well. http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-forms/

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/welcome" />

    <EditText
        android:id="@+id/EditTextName"
        android:layout_height="wrap_content"
        android:hint="@string/name"
        android:inputType="textPersonName"
        android:layout_width="fill_parent">
    </EditText>

    <EditText
        android:id="@+id/EditTextEmail"
        android:layout_height="wrap_content"
        android:hint="@string/email"
        android:inputType="textEmailAddress"
        android:layout_width="fill_parent">
    </EditText>

    <Spinner
        android:id="@+id/SpinnerStatus"
        android:layout_height="wrap_content"
        android:prompt="@string/status"
        android:layout_width="fill_parent"
        android:entries="@array/statuslist">
    </Spinner>

    <EditText  
        android:id="@+id/EditTextFeedbackBody"  
        android:layout_height="wrap_content"  
        android:hint="@string/changebody"  
        android:inputType="textMultiLine"  
        android:lines="5"  
        android:layout_width="fill_parent">  
    </EditText>

    <Button
        android:id="@+id/ButtonSendChange"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:onClick="sendChange"
        android:text="@string/changebutton">
    </Button>

</LinearLayout>

MadisonStudios.java

package com.madisonstudios.supportapp;

import android.app.Activity; 
import android.os.Bundle;

 public class MadisonStudios extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
     }

    public void sendChange(View button) {  
        // Do click handling here       
      }  
   }

Upvotes: 0

Views: 5452

Answers (2)

Alex Finocchiaro
Alex Finocchiaro

Reputation: 298

You should import it. If you are using Eclipse, press Ctrl+Shift+o.

Upvotes: 0

user370305
user370305

Reputation: 109247

import android.view.View;

Add this line in import statements..

Upvotes: 5

Related Questions