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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:42:17+00:00 2026-05-24T09:42:17+00:00

i’m getting the following exception: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{cs.workshop.solvedroid/cs.workshop.solvedroid.SolveCaptureActivity}: java.lang.NullPointerException when i

  • 0

i’m getting the following exception: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{cs.workshop.solvedroid/cs.workshop.solvedroid.SolveCaptureActivity}: java.lang.NullPointerException

when i run the application, get to the MainMenuActivity and try to open the SolveCaptureAvctivity i get the exception.

i’ve other Qs about this exception but they all point to the AndroidManifest.xml and it
seems fine to me. what can it be? please help

public class SolveCaptureActivity extends Activity {

Button bCamera;
ImageView captured_image = ( ImageView ) findViewById( R.id.image_capture_photo);

private static final int PICTURE_REQUEST = 0;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.solve_capture);
    Log.e("mydebug", "ERROR ERROR ERROR");
    /*
    // "Back" button 
    Button bBack = (Button) findViewById(R.id.button_back);
    bBack.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent gotoBack = new Intent();
            setResult(RESULT_OK, gotoBack);
            finish();
        }
    });
    */

    // "Camera" button
    bCamera = (Button) findViewById(R.id.button_camera);
    bCamera.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent camera = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);   
            startActivityForResult(camera, PICTURE_REQUEST);
            int caemraRequestCode = 0, CameraResultCode = -1;
            Intent data = new Intent();
            try{
            onActivityResult(caemraRequestCode, CameraResultCode, data);
            }
            catch(Exception e){
                Log.e("mydebug", "ERROR ERROR ERROR");
            }


        }

        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            Log.d("mylog", "here1");
            Log.d("mylog", Integer.toString(requestCode));
            Log.d("mylog", Integer.toString(resultCode));
            if (requestCode == PICTURE_REQUEST) {
                Log.d("mylog", "here2");
                if (resultCode == Activity.RESULT_OK){
                    // Display image received on the view;
                    Log.d("mylog", "here3");
                    Log.d("mylog", "here4");
                    Bitmap photo = (Bitmap) data.getExtras().get("data");                   
                    if (photo != null) { // Display your image in an ImageView in your layout (if you want to test it)
                        Log.d("mylog", "here5");
                        ImageView pictureHolder = (ImageView) findViewById(R.id.image_capture_photo);
                        pictureHolder.setImageBitmap(photo);                             
                    }
                }
            }
        }
    });


}

}

public class MainMenuActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainmenu);


    // "Solve Capture" button
    Button bSlvCapture = (Button) findViewById(R.id.button_mainmenu_solvecapture);
    bSlvCapture.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent gotoSolveCapture = new Intent(v.getContext(), SolveCaptureActivity.class);
            startActivityForResult(gotoSolveCapture, 0);
        }
    });

    // "Solve Manual" button
    Button bSlvManual = (Button) findViewById(R.id.button_mainmenu_solvemanual);
    bSlvManual.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent gotoSolveManual = new Intent(v.getContext(), SolveManualActivity.class);
            startActivityForResult(gotoSolveManual, 0);
        }
    });

    // "About" button
    Button bAbout = (Button) findViewById(R.id.button_mainmenu_about);
    bAbout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent gotoAbout = new Intent(v.getContext(), AboutActivity.class);
            startActivityForResult(gotoAbout, 0);
        }
    });    

}
}

08-07 18:33:23.854: INFO/ActivityManager(70): Displayed cs.workshop.solvedroid/.MainMenuActivity: +4s385ms
08-07 18:33:26.784: INFO/ActivityManager(70): Starting: Intent { cmp=cs.workshop.solvedroid/.AboutActivity } from pid 330
08-07 18:33:26.984: DEBUG/dalvikvm(330): GC_EXTERNAL_ALLOC freed 11K, 53% free 2582K/5379K, external 7607K/9499K, paused 51ms
08-07 18:33:28.434: INFO/ActivityManager(70): Displayed cs.workshop.solvedroid/.AboutActivity: +1s68ms
08-07 18:33:29.104: WARN/KeyCharacterMap(330): No keyboard for id 0
08-07 18:33:29.104: WARN/KeyCharacterMap(330): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
08-07 18:33:30.674: INFO/ActivityManager(70): Starting: Intent { cmp=cs.workshop.solvedroid/.SolveCaptureActivity } from pid 330
08-07 18:33:30.834: DEBUG/AndroidRuntime(330): Shutting down VM
08-07 18:33:30.834: WARN/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): FATAL EXCEPTION: main
08-07 18:33:30.874: ERROR/AndroidRuntime(330): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{cs.workshop.solvedroid/cs.workshop.solvedroid.SolveCaptureActivity}: java.lang.NullPointerException
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.os.Looper.loop(Looper.java:123)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.ActivityThread.main(ActivityThread.java:3647)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at java.lang.reflect.Method.invoke(Method.java:507)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at dalvik.system.NativeStart.main(Native Method)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): Caused by: java.lang.NullPointerException
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.Activity.findViewById(Activity.java:1647)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at cs.workshop.solvedroid.SolveCaptureActivity.(SolveCaptureActivity.java:15)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at java.lang.Class.newInstanceImpl(Native Method)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at java.lang.Class.newInstance(Class.java:1409)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1536)
08-07 18:33:30.874: ERROR/AndroidRuntime(330): ... 11 more

manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="cs.workshop.solvedroid"
      android:versionCode="1"
      android:versionName="1.0">
    uses-sdk android:minSdkVersion="9" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:label="@string/app_name" android:name=".MainMenuActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:label="@string/app_name" android:name="AboutActivity"></activity>
        <activity android:label="@string/app_name" android:name="SolveCaptureActivity"></activity>
        <activity android:label="@string/app_name" android:name="SolveManualActivity"></activity>
        <activity android:label="@string/app_name" android:name="ManualSolutionActivity"></activity>

    </application>
manifest>

  • 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-24T09:42:18+00:00Added an answer on May 24, 2026 at 9:42 am

    You cannot use findViewById() until after setContentView() is called.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.