Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360084

Summary: Type onClickListener cannot be resolved to a type
Product: [Eclipse Project] PDE Reporter: sai_rajarajan
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
onClickListener cannot be resolved to a type none

Description sai_rajarajan CLA 2011-10-06 07:37:18 EDT
Build Identifier: Eclipse Classic 3.7

I am a  new android apps developer, I am creating a new sudoku apps derived from org.example.sudoku; this is my code, given below.

package org.example.sudoku;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class SudokuActivity extends Activity implements onClickListener
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        View continueButton = this.findViewById(R.id.Continue_button);
        continueButton.setOnClickListener(this);
        
    }
    public void onClick(View v)
    {
    	switch (v.getId())
    	{
    	case R.id.about_button:
    		Intent i = new Intent(this, about.class);
    		startActivity(i);
    		break;
    		
    	}
    	
    }
}


here onClickListener and setOnClickListener has marked as red line and display error as Type onClickListener cannot be resolved to a type for OnClickListener, and The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SudokuActivity) error for setOnClickListener. so and I tried to clear the error using Ctrl+Shift+o. When I tried, that time the imports android.view.View.onClickListener is automatically removed from Activity. so What can i do? How I correcting the errors. Please help me.

Reproducible: Always
Comment 1 sai_rajarajan CLA 2011-10-06 07:50:59 EDT
Created attachment 204661 [details]
onClickListener cannot be resolved to a type

Please verify my code, give correct suggestion to me. 

the errors show in below
1.onClickListener cannot be resolved to a type
2.The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SudokuActivity)
3.The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SudokuActivity)
4.The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SudokuActivity)
5.The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SudokuActivity)
6.The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SudokuActivity)
Comment 2 Curtis Windatt CLA 2011-10-06 10:57:34 EDT
This is not a bug report.  It does not relate to PDE.  For help with code design, you can try using the Eclipse forums http://www.eclipse.org/forums.

The type OnClickListener doesn't exist where you think it does.  You can see if it is available in your workspace at all by using open type Ctrl-Shift-T.  I expect that it is not available, in which case the android plug-in is missing code you require.