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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:37:25+00:00 2026-06-16T11:37:25+00:00

I am trying to create a test app for a library I am creating.

  • 0

I am trying to create a test app for a library I am creating. When my library is called, it creates an intent and starts an activity.

intent = new Intent(getApplicationContext(), video_on_load.class);
myLib.this.startActivity(intent);

My program it seems my program is crashing on creating the new Intent. I tried to why this would happen, and I saw that in my app I have to had the activity to the AndroidManafest, so I added the following line to my manifest:

activity android:name="com.example.myLib.video_on_load"></activity>   

However my app is still crashing with the message “Unfortunately, TestApp has stopped.” I am unsure how to continue. I am fairly new to android programming, so it may be something simple I missed. Let me know if you need any other information that would be useful in debugging this problem.

My video_on_load class is as follows:

public class video_on_load extends Activity {
    private RelativeLayout layout;
    private ProgressBar progressBar;    

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video_on_load);

        layout = (RelativeLayout) findViewById(R.id.video_onLoad_layout);
        progressBar = (ProgressBar) findViewById(R.id.video_onLoad_progress);
    }

Edit:

Relevent LogCat:

  12-28 17:53:23.824: E/AndroidRuntime(25042): java.lang.NullPointerException
  12-28 17:53:23.824: E/AndroidRuntime(25042):  at android.content.ContextWrapper.getPackageName(ContextWrapper.java:135)
  12-28 17:53:23.824: E/AndroidRuntime(25042):  at android.content.ComponentName.<init>(ComponentName.java:75)
  12-28 17:53:23.824: E/AndroidRuntime(25042):  at android.content.Intent.<init>(Intent.java:3491)

video_on_load.xml:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/video_onLoad_layout" >

<ProgressBar android:id="@+id/video_onLoad_progress"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerInParent="true"
             style="@android:style/Widget.ProgressBar.Large" />

</RelativeLayout>

Thank you

  • 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-16T11:37:26+00:00Added an answer on June 16, 2026 at 11:37 am

    Change

    intent = new Intent(getApplicationContext(), video_on_load.class);
    myLib.this.startActivity(intent);
    

    into:

    intent = new Intent(this, video_on_load.class);
    startActivity(intent);
    

    As long as you are putting this code somewhere in an Activity, you should be good to go. Note, a An application is has a context, and Application has Activities, and Activities also have a Context. Try reading some documentation on Activities and Context’s to get a better understanding.

    Your error message shows that something is null in your call, and that it is related to getApplicationContext(). Good luck

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

Sidebar

Related Questions

I'm trying to create a mock HttpContextBase for unit test. var fakePrinciple = new
I create iTunes connect test user, but when I am trying to test in-app-purchase,
I'm trying to create a test app in which the user can pause an
I am trying to create a multiple choice test app. I have this code
Trying to create a test app that imports another test package. The test apps
I'm new to Google App Engine, and I tried to create a test project
I am trying to create a test harness for our QA staff to test
I have the below configuration where I'm trying to create a test C function
I'm trying to create an Android test project from within my main project. Exactly
I am trying to create a unit test for a method that takes a

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.