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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:42:19+00:00 2026-06-08T14:42:19+00:00

I am fairly new to android programming and I’m working off an example from

  • 0

I am fairly new to android programming and I’m working off an example from a book I purchased but the example app they are showing me how to make is coming up with bugs in it. Its very simple so far but I am getting the following error so far:

07-30 04:36:59.265: W/System.err(540): java.lang.ClassNotFoundException: com.sanbox.basicsstarter.LifeCycleTest
07-30 04:36:59.285: W/System.err(540):  at java.lang.Class.classForName(Native Method)
07-30 04:36:59.285: W/System.err(540):  at java.lang.Class.forName(Class.java:217)

My code is really on 3 seperate files the first is the main activity calling the AndroidBasicsStarterActivity:

package com.sandbox.basicsstarter;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.util.Log;

public class AndroidBasicsStarterActivity extends ListActivity {
String tests[] = { "LifeCycleTest", "SingleTouchTest", "MultiTouchTest",
"KeyTest", "AccelerometerTest", "AssetsTest",
"ExternalStorageTest", "SoundPoolTest", "MediaPlayerTest",
"FullScreenTest", "RenderViewTest", "ShapeTest", "BitmapTest",
"FontTest", "SurfaceViewTest" };
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setListAdapter(new ArrayAdapter<String>(this,
    android.R.layout.simple_list_item_1, tests));
}

private void log(String text) {
    Log.d("LifeCycleTest ", text);
}

@Override
protected void onListItemClick(ListView list, View view, int position,
    long id) {
        super.onListItemClick(list, view, position, id);
        String testName = tests[position];
        log(testName);
    try {
        Class clazz = Class.forName("com.sanbox.basicsstarter." + testName);

        Intent intent = new Intent(this, clazz);
        startActivity(intent);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
}

then the LifeCycleTest class:

package com.sandbox.basicsstarter;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class LifeCycleTest extends Activity {
StringBuilder builder = new StringBuilder();
TextView textView;
private void log(String text) {
    Log.d("LifeCycleTest", text);
    builder.append(text);
    builder.append('\n');
    textView.setText(builder.toString());
}
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    textView = new TextView(this);
    textView.setText(builder.toString());
    setContentView(textView);
    log("created");
}
@Override
protected void onResume() {
    super.onResume();
    log("resumed");
}
@Override
protected void onPause() {
        super.onPause();
        log("paused");
    if (isFinishing()) {
        log("finishing");
    }
}
}

And lastly the manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sandbox.basicsstarter"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".AndroidBasicsStarterActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:label="Life Cycle Test"
        android:name=".LifeCycleTest"
        android:configChanges="keyboard|keyboardHidden|orientation" />
</application>

</manifest>

So can anyone help me figure out where my error is occuring? I already tried cleaning up the project but that did not resolve anything. Thanks so much for any possible ideas!

  • 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-08T14:42:23+00:00Added an answer on June 8, 2026 at 2:42 pm

    Do this to start the activity:

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

    There is no need to find the class using Class.forName

    EDIT

    The reason why it can’t find the class is because you have misspelled the package.

    It should be com.sandbox.basicsstarter. You omitted the d in sandbox.

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

Sidebar

Related Questions

I'm fairly new to Android programming, so this may be a simple question, but
I'm fairly new to Java and Android programming in general but I would like
I am fairly new to Android programming, but I am getting pretty good at
I'm fairly new to Android programming and to Java in general, but I have
I'm fairly new to Android development and am working on an app which allows
So I am fairly new to android programming. I have a database and I
I am fairly new to Android programming and was wondering how I can get
Ok, im fairly new to android but i have managed to teach myself the
I have just began opengl programming in android and i am fairly new to
I'm fairly new to Android developing, and I've been assigned to make an app

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.