Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8492981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:52:50+00:00 2026-06-10T22:52:50+00:00

I keep getting the following error in Eclipse: Type Cannot make a static reference

  • 0

I keep getting the following error in Eclipse:

Type Cannot make a static reference to the non-static method setVisibility(int) from the type View

My code is:

package com.example.testing;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends Activity {

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

public void onLoveButtonClicked(View view) {
    TextView haikuTextView = (TextView) findViewById(R.id.haikuTextView);
    TextView.setVisibility(View.VISIBLE); //error here
}
 }

I’m only a beginner at java so I don’t know what’s causing that problem. I have googled the error but I don’t get anything that helps me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:52:52+00:00Added an answer on June 10, 2026 at 10:52 pm

    You need to use:

    haikuTextView.setVisibility(View.VISIBLE); 
    

    TextView is the class and haikuTextView is your variable. You cannot change the visibility of an entire class. But you can change the visibility of your variable.


    When you wrote:

    <TextView
        android:id="@+id/haikuTextView"
        ... />
    

    you created one instance of the TextView class. You can create a lot of instances of the TextView class, but when you want to change some feature about a particular in one instance you have to specify which TextView you want to change.

    When you wrote TextView.setVisibility() you tried to change every TextView. Now the TextView class doesn’t have a method setVisibility() to change every TextView, but it does have setVisibilty() to change one instance.

    So
    When you try to access every TextView with TextView.setVisibility() this is a “static reference” but, like I said, there is no method to call setVisibility() every TextView.

    If you use haikuTextView.setVisibilty() to change the visibility of one instance, this will work because this is “non-static method” exists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting the following error: Method not found: 'Void Castle.MicroKernel.ComponentActivator.ComponentActivatorException..ctor this is from
I keep getting the following error when trying to build the masstransit source from
Im setting up a simple method and I keep getting the following error: Syntax
I keep getting the following error: $ ./test.py -bash: ./test.py: cannot execute binary file
I keep getting the following error when trying to make one column in a
I've tried many configurations, but I keep getting the following error upon opening eclipse:
I keep getting the following error: Cannot access a disposed object. Object name: 'AdoTransaction'.
I keep getting the following error: Parse error: syntax error, unexpected T_SL in /home/a4999406/public_html/willingLog.html
I keep getting the following error: AttributeError: Caribou instance has no attribute 'on_key_up' The
I keep getting the following error message ERROR 1064 (42000): You have an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.