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

  • Home
  • SEARCH
  • 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 611437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:47:01+00:00 2026-05-13T17:47:01+00:00

Hi ive got a custom listview and im trying to start a new activity

  • 0

Hi ive got a custom listview and im trying to start a new activity on a button click however an occur occurs when i try to set an intent , i guess this is because my custom array class does not extend activity. The buttons trigger an alarm to be set. Is there any way i can get an intent to work in this class?

Below is my code for the class.

public class customArray extends ArrayAdapter<String> {
SatMain sm = new SatMain();


int resource;

public customArray(Context cont, int _resource, List<String> items) {
    super(cont, _resource, items);
    resource = _resource;

}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    RelativeLayout rl;

    String prod = getItem(position);
    if (convertView == null) {
        rl = new RelativeLayout(getContext());
        LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        vi.inflate(resource, rl, true);
    } else {
        rl = (RelativeLayout) convertView;
    }
    TextView t1 = (TextView) rl.findViewById(R.id.text12);
    t1.setText(prod);
    final Button b1 = (Button) rl.findViewById(R.id.widget29);

    b1.setText("efwrf");

    if (position == 2) {

        b1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {


                 Intent intent = new Intent(customArray.class, SatMain.class);
                    startActivity(intent);


                b1.setText("alarm set");



            }
        });

    }

    if (position == 0) {

        b1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

            }
        });
        b1.setText("number 0");
    }

    return rl;
}

}

  • 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-13T17:47:02+00:00Added an answer on May 13, 2026 at 5:47 pm

    It just sais that the constructor for
    intent is undefined ( havent run it as
    its a compile error)

    Well, you need to use a proper Intent constructor. Instead of using customArray.class (which is a Class) or customArray (which is an ArrayAdapter), you need to supply a Context. You are using getContext() several places in this code — use it here as well, I suppose.

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

Sidebar

Related Questions

I've got an JComboBox with a custom inputVerifyer set to limit MaxLength when it's
I've got a ListView with a custom BaseAdapter. The list items contain CheckBoxes that
Hi guys, ive got a stupid problem. My Custom handler is working 100% on
I've got a custom control ive created that is instanced in my view, in
Ive got an iPhone/iPad universal application and I wanted to have a custom navigation
I've got a custom ItemsControl in my project and I'm trying to write a
I've been stuck on a little bug trying to implement a custom listview in
I've got a custom drawable resource to display my items in a ListView, actually
I've got a custom handler applied to a class (using the Policy Injection Application
I've create a WinForms control that inherits from System.Windows.Forms.UserControl...I've got some custom events on

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.