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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:54:34+00:00 2026-06-16T14:54:34+00:00

I was trying to create a new class which should generate a ListView, but

  • 0

I was trying to create a new class which should generate a ListView, but I have an error..
Error says unable to start activity I’m confused; can anyone tell me where the problem is, what did I do wrong or what can I do?

CODE

public class ManagerView extends ListActivity{

DBAdapter db;
Cursor cr;
String arr[];


@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
}



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
            db = new DBAdapter(this);
            cr = db.getAllRecords();
    int i = 0;
    Cursor crr = null;
    
    try {crr = db.getRecord(4);}
    catch (IOException e) {e.printStackTrace();}
    
    for (cr.moveToFirst(); !cr.moveToLast(); cr.moveToNext()){
        
        arr[i] = crr.getString(i);
        i++;
        }
        
    setListAdapter (new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arr));
    }

}

ERROR

12-30 17:11:47.352: E/AndroidRuntime(1299): FATAL EXCEPTION: main
12-30 17:11:47.352: E/AndroidRuntime(1299): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tsfc/com.example.tsfc.ManagerView}: java.lang.NullPointerException
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.os.Looper.loop(Looper.java:137)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.ActivityThread.main(ActivityThread.java:5039)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at java.lang.reflect.Method.invokeNative(Native Method)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at     java.lang.reflect.Method.invoke(Method.java:511)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at dalvik.system.NativeStart.main(Native Method)
12-30 17:11:47.352: E/AndroidRuntime(1299): Caused by: java.lang.NullPointerException
12-30 17:11:47.352: E/AndroidRuntime(1299):     at com.example.tsfc.DBAdapter.getAllRecords(DBAdapter.java:100)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at com.example.tsfc.ManagerView.onCreate(ManagerView.java:32)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.Activity.performCreate(Activity.java:5104)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-30 17:11:47.352: E/AndroidRuntime(1299):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-30 17:11:47.352: E/AndroidRuntime(1299):     ... 11 more    
  • 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-16T14:54:36+00:00Added an answer on June 16, 2026 at 2:54 pm

    Unable to find explicit activity class
    {com.example.tsfc/com.example.tsfc.ManagerView}; have you declared
    this activity in your AndroidManifest.xml? 12-30 16:35:09.451:
    E/AndroidRuntime(1049): at

    make sure you have declared your activity in AndroidManifest as:

    <activity android:name="com.example.tsfc.ManagerView" />
    

    and
    Currently you are initializing DBAdapter in wrong place . move all database class initialization and getAllRecords inside onCreate of ListActivity as:

    public  class ManagerView extends ListActivity{
    
    DBAdapter db ;
    Cursor cr ;
    String arr[];
    
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
    
         db = new DBAdapter(ManagerView.this);
         cr = db.getAllRecords();
    }
    
    // your code here,...
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a generic class which new's up an instance of
I am now trying to create new database manager under Fragment class. But unfortunately,
I am trying to create a new class Dog that inherits via prototypical inheritance
Trying to create a new Dedicated Cache Role in Windows Azure but get the
I'm trying to expose a fairly simple C# class to COM which should be
I've been trying to create a new variable of type Cmplx (which is my
I am trying to get a custom enum class working which should enable me
I'm trying to create a form which allows me to submit new records for
I'm new to both android and game development and have been trying to create
I'm trying to do something which should be relatively easy, but i just dont

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.