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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:40:30+00:00 2026-05-25T20:40:30+00:00

Anyone have any idea why this don’t works ? the startActivity(i); Not Working public

  • 0

Anyone have any idea why this don’t works ? the startActivity(i);

Not Working

public class UiHelper {

 /**
 * About Dialog
 */
public static void showAboutDialog(Activity activity) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(R.string.about_title);

    // build view from layout
    LayoutInflater factory = LayoutInflater.from(activity);
    final View dialogView = factory.inflate(R.layout.about_dialog, null);

    TextView versionText = (TextView) dialogView.findViewById(R.id.about_version);
    versionText.setText(activity.getString(R.string.about_version) + " " + getVersion(activity));

    builder.setView(dialogView);

    builder.setIcon(android.R.drawable.ic_dialog_info);
   /** builder.setNeutralButton(activity.getString(R.string.button_close),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });**/

    builder.setPositiveButton("Facebook",
    new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
              String url = "http://www.facebook.com/page/";
              final Intent i = new Intent(Intent.ACTION_VIEW);
              i.setData(Uri.parse(url));
              startActivity(i); /** <<-- Error <<--**/

        }


    });


    builder.setNegativeButton("Website",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                    String url = "http://www.website.com/";
                    Intent i = new Intent(Intent.ACTION_VIEW);
                    i.setData(Uri.parse(url));
                    startActivity(i);
                }

            });
    AlertDialog question = builder.create();
    question.show();
}

but i try this will works

Working

AlertDialog.Builder alert = new AlertDialog.Builder(PTRmainActivity.this);
        alert.setTitle("About");
        alert.setMessage("Version 1.0.0");
        alert.setIcon(R.drawable.icon);
        alert.setPositiveButton("Facebook",
        new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {

                String url = "http://www.facebook.com/page/";
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);

            }
        });

        alert.setNegativeButton("Website",
        new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {

                String url = "http://www.website.com/";
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);
            }
        });

        alert.show();
  • 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-25T20:40:31+00:00Added an answer on May 25, 2026 at 8:40 pm

    Make the function take in a final argument:

    public static void showAboutDialog(final Activity activity) {
    

    and then use that argument to start the Activity (static functions don’t have access to any non-static instance methods:

    builder.setPositiveButton("Facebook",
        new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                  String url = "http://www.facebook.com/page/";
                  final Intent i = new Intent(Intent.ACTION_VIEW);
                  i.setData(Uri.parse(url));
                  activity.startActivity(i); /** <<-- Error <<--**/
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't have any idea how to use this class in .net. Anyone wants
Anyone have any idea about CASlotProxy Class in Cocoa (iOS SDK)? I found it
Anyone have any Idea why I don't have this function (setTextFormat) in my QTextEdit
Does anyone have any idea what this jQuery selector will do? object.find('td:eq(1) div div');
Anyone have any idea why my jQuery carousel is working fine at the bottom
Anyone have any idea how I would go about converting a timestamp in milliseconds
Does any one have any idea why this would be happening? This is some
I have no idea why any one would do this (include support for Lists
Anyone have any idea how to connect to their FTP server? I am using
Anyone have any idea why shuffle() would only return 1 item? when using: $array2

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.