Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to fix error No enclosing instance of the type...

807591Mar 14 2008 — edited Mar 18 2008
Hello,

Maybe some body know how to fix this error: No enclosing instance of the type MyMap is accessible in scope. Please, help me. Below is my code:
public class MyMap extends MapView
{ 
    public void MyMap()
    {
    } 
    public MyMap(Context context, AttributeSet attrs, java.util.Map inflateParams)
    {
		super(context, attrs, inflateParams);
    }
}

class Top
{
	Top()
	{
		// Here is error;
		// No enclosing instance of the type MyMap is accessible in scope.
		MapView v=(MapView)MyMap.this.findViewById(R.id.mapview); 
	}
}
MapView have final method. How I understand this method can be called without creating object of MyMap.
public final View findViewById(int id)
How I can resolve this bug?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2008
Added on Mar 14 2008
4 comments
663 views