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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:13:50+00:00 2026-05-22T02:13:50+00:00

My code: package elf.app; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView;

  • 0

My code:

package elf.app;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import elf.app.entity.ELFList;
import elf.app.entity.Entry;
import elf.app.test.FakeComm;

// TODO Kunna skicka att något är färdigt (ett rum är städat).

public class RoomListActivity extends ListActivity {
private ELFList eList;
//  private FakeComm fakecomm;
private Bundle extras;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.extras = getIntent().getExtras();
    eList = new ELFList();

//      fakecomm = new FakeComm();
//      eList.add(fakecomm.getData());

    String[] strArr = {"asd","sdf","dfg"};
    eList.add(strArr);

    String[] str = eList.returnNames();


    setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, str));

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);

    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Entry e = eList.getEntry(position);
            String roominfo = e.toString();


            Intent intent = new Intent(this, RoomInfoActivity.class);
            intent.putExtra("entry",roominfo);
            this.startActivity(intent);

                // old stuff
            // String message;
            // message = eList.getEntryInfo(position);
            // Toast.makeText(getApplicationContext(),
            // message, Toast.LENGTH_SHORT).show();
        }
    });
}

}

I’m getting errors at the following lines:

Intent intent = new Intent(this, RoomInfoActivity.class);

and

this.startActivity(intent);

I don’t have much of a clue why I get these errors, the exact output in the editor for these errors are:

  • “The constructor Intent(new AdapterView.OnItemClickListener(){}, Class ) is undefined”
  • “The method startActivity(Intent) is undefined for the type new AdapterView.OnItemClickListener(){}”

I’m an Android newbie so please take that into consideration, however I have studied Java for about a year.

  • 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-22T02:13:51+00:00Added an answer on May 22, 2026 at 2:13 am

    Fix

    Intent intent = new Intent(this, RoomInfoActivity.class);
    

    to

    Intent intent = new Intent(RoomListActivity.this, RoomInfoActivity.class);
    

    The error is because by this you refer to OnClickListener. The problem is fixed, if you refer to the Activity’s this. The second error is the same – wrong reference. Just remove this, and startActivity() method will be searched within the enclosing class too.

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

Sidebar

Related Questions

My code: package com.example.linkingpage; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent;
For the following code: package FileOperations import java.net.URL object FileOperations { def processWindowsPath(p: String):
I have the following code package myPackage; import org.neo4j.graphdb; import org.neo4j.kernel.EmbeddedGraphDatabase; public class dbServlet
Looking for help with the following code: package pkgPeople; import java.io.File; import java.io.FileOutputStream; import
I am running the following piece of code: package { import fl.controls.Button; import fl.controls.Label;
the following code returns the following runtime error. why? code: package { import flash.display.Sprite;
To be specific, I was trying this code: package hello; public class Hello {
I'm trying to determine how to modify SAP R/3 package code of an installed
I'm trying to use the Optiflag package in my Ruby code and whenever I
I'm using LaTeX 's listings package to format source code. Unfortunately I get curly

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.