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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:43:06+00:00 2026-06-18T15:43:06+00:00

Doing an Apprenticeship, a company told me to develop an app for Jelly-bean, but

  • 0

Doing an Apprenticeship, a company told me to develop an app for Jelly-bean, but suddenly now they want to port some of my work to froyo.

I wanted to start over but i can’t even start, changing a TextView text drops me a nullPointerException:

package com.videopleyer22ics;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

    public class MainActivity extends Activity
    {
        TextView tv1;

        @Override
        protected void onCreate(Bundle savedInstanceState) 
        {
            super.onCreate(savedInstanceState);

            tv1 = (TextView) findViewById(R.id.texto1);

            setContentView(R.layout.activity_main);

            tv1.setText("Text changed");
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.activity_main, menu);
            return true;
        }

}

Here’s the Logcat dump

02-11 14:52:34.058: E/AndroidRuntime(510): FATAL EXCEPTION: main
02-11 14:52:34.058: E/AndroidRuntime(510): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.videopleyer22ics/com.videopleyer22ics.MainActivity}: java.lang.NullPointerException
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.os.Looper.loop(Looper.java:123)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.ActivityThread.main(ActivityThread.java:4627)
02-11 14:52:34.058: E/AndroidRuntime(510):  at java.lang.reflect.Method.invokeNative(Native Method)
02-11 14:52:34.058: E/AndroidRuntime(510):  at java.lang.reflect.Method.invoke(Method.java:521)
02-11 14:52:34.058: E/AndroidRuntime(510):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-11 14:52:34.058: E/AndroidRuntime(510):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-11 14:52:34.058: E/AndroidRuntime(510):  at dalvik.system.NativeStart.main(Native Method)
02-11 14:52:34.058: E/AndroidRuntime(510): Caused by: java.lang.NullPointerException
02-11 14:52:34.058: E/AndroidRuntime(510):  at com.videopleyer22ics.MainActivity.onCreate(MainActivity.java:54)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-11 14:52:34.058: E/AndroidRuntime(510):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-11 14:52:34.058: E/AndroidRuntime(510):  ... 11 more

I Just don’t know what to do since it works fine on ICS, and i need help.
Do you know a way to port an ICS proyect to froyo? I don’t mind to do it again on scratch.

  • 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-18T15:43:07+00:00Added an answer on June 18, 2026 at 3:43 pm

    Swap the order of setContentView() and findViewById(). You are trying to find the TextView before the main layout has been inflated.

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

Sidebar

Related Questions

Doing some 3D stuff in wpf- want to use a simpler test to see
Doing a very simple iPad app that plays a video in fullscreen. I want
Doing some SOAP calls to a 3rd party application. They provide this soap header
The company I am doing my intership/appretinceship in, does mainly PLC programming with Siemens
Doing some jquery animation. I have certain divs set up with an attribute of
Doing some homework here (second assignment, still extremely green...). The object is to read
Doing a some practice questions for exam tomorrow can't figure out this one What
Doing some archiving/deleting of some uncommonly used databases on an Oracle server. Has anyone
Doing some refactoring in some legacy code I've found in a project. This is
Doing some code reading and stumbled upon this snippet that I haven't seen before:

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.