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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:44:28+00:00 2026-06-17T14:44:28+00:00

Have a look at my AndroidMenifest.xml <?xml version=1.0 encoding=utf-8?> <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.myapp android:versionCode=1 android:versionName=1.0

  • 0

Have a look at my AndroidMenifest.xml

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
    </uses-permission>

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity      android:name="com.myapp.activities.exercisesetsactivity.ExercisesetsActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity
            android:name="com.myapp.activities.mainactivity.MainActivity"
            android:label="@string/app_name" >
            <!--intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter-->
        </activity>

        <service
            android:name="com.myapp.services.guideservice.GuideService"
            android:exported="false" >
        </service>
    </application>
    </manifest>

Initially, I had MainActivity was my default activity. Later I tried to change it to ExercisesetsActivity. That is where I started getting below error in my logcat.

 > 
    01-22 22:09:51.831: E/AndroidRuntime(22676): FATAL EXCEPTION: main
        01-22 22:09:51.831: E/AndroidRuntime(22676): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.activities.exercisesetsactivity.ExercisesetsActivity}: java.lang.NullPointerException
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.os.Handler.dispatchMessage(Handler.java:99)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.os.Looper.loop(Looper.java:137)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.ActivityThread.main(ActivityThread.java:4745)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at java.lang.reflect.Method.invokeNative(Native Method)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at java.lang.reflect.Method.invoke(Method.java:511)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at dalvik.system.NativeStart.main(Native Method)
        01-22 22:09:51.831: E/AndroidRuntime(22676): Caused by: java.lang.NullPointerException
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:101)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at com.myapp.activities.exercisesetsactivity.ExercisesetsActivity.<init>(ExercisesetsActivity.java:24)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at java.lang.Class.newInstanceImpl(Native Method)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at java.lang.Class.newInstance(Class.java:1319)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
        01-22 22:09:51.831: E/AndroidRuntime(22676):    ... 11 more

If I change it to MainActivity, it works fine. However, I want ExercisesetsActivity to come up first.

package com.myapp.activities.exercisesetsactivity;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import com.myapp.R;
import com.myapp.activities.mainactivity.MainActivity;
import com.myapp.businessclasses.Exercisesetlist;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class ExercisesetsActivity extends Activity {
**private Exercisesetlist myExerciseSetList = new Exercisesetlist(this.getApplicationContext());**

private class currentListAdapter extends ArrayAdapter<String> {

    public currentListAdapter() {
        super(ExercisesetsActivity.this, R.layout.activity_exercisesetlist,
                ExercisesetsActivity.this.myExerciseSetList.setNames);
        // TODO Auto-generated constructor stub
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        LayoutInflater inflater = getLayoutInflater();

        View row = inflater.inflate(R.layout.activity_exercisesetlist, parent,
                false);
        TextView label = (TextView) row.findViewById(R.id.tvItems);

        String strContent = ExercisesetsActivity.this.myExerciseSetList.setNames
                .get(position);
        label.setText(strContent);
        label.setTag(position);
        label.setOnClickListener(exerciseClickListner);

        return row;
    }

}

private android.view.View.OnClickListener exerciseClickListner = new android.view.View.OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        int pos = (Integer) v.getTag();

        Intent intent = new Intent(ExercisesetsActivity.this.getApplicationContext(),
                MainActivity.class);
        intent.putExtra(ExercisesetsActivity.this.getResources().getString(R.string.EXERCISESETID),
                ExercisesetsActivity.this.myExerciseSetList.setIDs.get(pos));
        startActivity(intent);
    }
};

// This is temporary
public void copyDBifnotexists() {
    String DATABASE_PATH = Environment.getExternalStorageDirectory()
            .getPath() + "/myapp/data/";
    String DATABSE_NAME = "db.db";

    File folders = new File(DATABASE_PATH);
    File file = new File(folders, DATABSE_NAME);
    if (!file.exists()) {
        folders.mkdirs();

        try {
            InputStream inputStream = this.getResources().openRawResource(
                    R.raw.db);
            FileOutputStream fileOutputStream = new FileOutputStream(file);

            byte buf[] = new byte[1024];
            int len;
            while ((len = inputStream.read(buf)) > 0) {
                fileOutputStream.write(buf, 0, len);
            }

            fileOutputStream.close();
            inputStream.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // TODO Auto-generated method stub
    setContentView(R.layout.activity_exercisesetlist);

    // This is temporary
    copyDBifnotexists();

    ListView lv = (ListView) findViewById(R.id.lvExerciselist);
    lv.setAdapter(new currentListAdapter());
}
}
  • 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-17T14:44:29+00:00Added an answer on June 17, 2026 at 2:44 pm
    private Exercisesetlist myExerciseSetList = new Exercisesetlist(this.getApplicationContext());
    

    I am Not Sure but it likely because without calling OnCreate() method you will not get context of that Activity. so try to initialize this inside OnCreate() method like as Below and see what happens.

    private Exercisesetlist myExerciseSetList;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        // TODO Auto-generated method stub
        setContentView(R.layout.activity_exercisesetlist);
    
        myExerciseSetList = new Exercisesetlist(this.getApplicationContext());
    
    }
    

    Hope it will Help you.

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

Sidebar

Related Questions

Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
have a look at the top menu on these two pages on Firefox: http://outsidemma.com/2010/100031-bj-penn-the-prodigy-jay-dee.php
Have a look at this jsfiddle: http://jsfiddle.net/Dh96F/1/ The Expand button will animate the widening
Please have look at this page & its source code. http://www.chemfluence.org.in/monetarist/index_copy.php Web page is
Have a look at the menu link Produkter on http://marckmann.se/ I would like to
Please have look at the following Three.js snippet http://jsfiddle.net/ahmedadel/GUr6y/3/ , the problem is the
I have the new 15 version android sdk and the new admob sdk. On
Have a look at the menus on this page: http://www.pieterdedecker.be/labs/vspwpg/?page_id=96 They look okay in
I have look-up-table as defined below and I'm making use of GCC. When I
I often see a pattern used in circumstances where we have look-up code that

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.