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 5980571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:49:12+00:00 2026-05-22T21:49:12+00:00

I made a textview clickable then it triggers an intent, it works but only

  • 0

I made a textview clickable then it triggers an intent, it works but only once. After clicking the textview the first time it’s no longer clickable and I have no idea why. Your help will be appreciated.

<TextView android:text="Click Me" android:layout_height="wrap_content"
android:layout_width="match_parent" android:id="@+id/textView1"
android:textSize="50dp" android:focusable="false" android:longClickable="true"></TextView>

TextView txt = (TextView) findViewById(R.id.textView1);

    txt.setOnLongClickListener(new OnLongClickListener() {

        public boolean onLongClick(View v) {
            // TODO Auto-generated method stub
            startActivity(new Intent(Example.this, Alert.class));

            return false;
        }
    });
  • 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-05-22T21:49:13+00:00Added an answer on May 22, 2026 at 9:49 pm

    What does the alert class do? If it is an activity it could be that it is being laid over the top of your current activity so although you can see your activity, it’s not at the top of the stack/in the foreground so you’re not actually pressing the TextView, you’re pressing a transparent activity that is over the top of it.

    The easiest way to check that is to press the TextView, then press your device’s back key and see if the TextView responds to the click.

    Or are you sure you’re not setting the same layout in Alert.class? That would make it look like it’s the same activity but if the Alert class doesn’t set the click listener, nothing is going to happen.

    The fact that you’re starting an activity with an intent and that’s making an instance of another class (which I assume is also an activity) stops the click working to me is seriously suggesting that Alert is getting the click somehow instead of Example. When you say things work fine if you remove the intent backs that up as well. Maybe you could post the full source of both classes?

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

Sidebar

Related Questions

I have made a popup, which works fine, but I'd like to write to
I have made a ListView with an ArrayAdapter. It works. But I had to
i was made an geolocation application.. it was works successfully but always make a
I want to open my made calculator after clicking on edittext field. I have
i have made menu list containing play, settings, exit. but clicking the button doesn
Made this nice little loop for hiding and showing div's, works as a charm
I made a discovery some time back. Just follow these steps: Create a .doc/.xls/.ppt
I made an html file called test.html then I navigated to it as http://site.com/test.html?test1=a
i made a small test app with 2 screens. the first screen contains an
I made a custom title bar for my app which works. However, when the

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.