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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:37:53+00:00 2026-06-18T12:37:53+00:00

My app works without any problem until close my app and return after more

  • 0

My app works without any problem until close my app and return after more than 15 min aprox it crash, if I return to my App after only 5 min all seems right. I can’t find the problem please help!!!

LogCat

    02-06 20:39:43.534: E/AndroidRuntime(1851): FATAL EXCEPTION: main
02-06 20:39:43.534: E/AndroidRuntime(1851): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.raigo.itivamin/com.raigo.itivamin.Bartabs}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.raigo.itivamin/com.raigo.itivamin.ObjetivosActivity}: java.lang.NullPointerException
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.os.Looper.loop(Looper.java:210)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.main(ActivityThread.java:4441)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at java.lang.reflect.Method.invokeNative(Native Method)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at java.lang.reflect.Method.invoke(Method.java:511)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at dalvik.system.NativeStart.main(Native Method)
02-06 20:39:43.534: E/AndroidRuntime(1851): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.raigo.itivamin/com.raigo.itivamin.ObjetivosActivity}: java.lang.NullPointerException
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:1808)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:737)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.widget.TabHost.setCurrentTab(TabHost.java:401)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.widget.TabHost.addTab(TabHost.java:240)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at com.raigo.itivamin.Bartabs.addTab(Bartabs.java:65)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at com.raigo.itivamin.Bartabs.setTabs(Bartabs.java:37)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at com.raigo.itivamin.Bartabs.onCreate(Bartabs.java:29)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.Activity.performCreate(Activity.java:4465)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
02-06 20:39:43.534: E/AndroidRuntime(1851):     ... 11 more
02-06 20:39:43.534: E/AndroidRuntime(1851): Caused by: java.lang.NullPointerException
02-06 20:39:43.534: E/AndroidRuntime(1851):     at com.raigo.itivamin.ObjetivosActivity.onCreate(ObjetivosActivity.java:25)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.Activity.performCreate(Activity.java:4465)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-06 20:39:43.534: E/AndroidRuntime(1851):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
02-06 20:39:43.534: E/AndroidRuntime(1851):     ... 23 more

AndroidManifest.xml

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />

    <application  android:name="com.raigo.itivamin.iTIVAapp"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/app_theme" >
        <activity
            android:name=".IngresodatosActivity"
            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:name="Bartabs" android:configChanges="orientation|screenSize"></activity>
        <activity android:name=".ObjetivosActivity" android:configChanges="orientation|screenSize"></activity>  
        <activity android:name=".BombaActivity" android:configChanges="orientation|screenSize"></activity>
        <activity android:name=".OpioideActivity"
            android:theme="@android:style/Theme.Dialog"></activity>    
        <activity android:name=".HipnoticoActivity"
             android:theme="@android:style/Theme.Dialog"></activity>   
        <activity android:name="org.achartengine.GraphicalActivity" />   
        <activity android:name=".GraficaActivity" android:configChanges="orientation|screenSize"></activity>
        <activity android:name=".SimuladorActivity" android:configChanges="orientation|screenSize"></activity>
        <activity android:name=".AyudaActivity" android:configChanges="orientation|screenSize"></activity>

        <service android:name=".SomeService1"></service>
    </application>

</manifest>

Bartabs.java

package com.raigo.itivamin;

import android.app.TabActivity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;


/**
 * @author Adil Soomro
 *
 */
@SuppressWarnings("deprecation")
public class Bartabs extends TabActivity  {
    /** Called when the activity is first created. */
//boolean simulador =false;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.main);
        //Bundle extras = getIntent().getExtras();
        //simulador= extras.getBoolean("simulador");
        setTabs() ;

    }

    private void setTabs()
    {

    if (((iTIVAapp)getApplication()).simulador==false){         
        addTab(getString(R.string.target), R.drawable.tab_objetivos, ObjetivosActivity.class);
        addTab(getString(R.string.pump), R.drawable.tab_bomba, BombaActivity.class);
        addTab2(getString(R.string.pk_pd), R.drawable.tab_chart,GraficaActivity.class);
        addTab(getString(R.string.help), R.drawable.tab_help, AyudaActivity.class);
    } else{
        addTab(getString(R.string.scheme), R.drawable.tab_bomba, SimuladorActivity.class);
        addTab2(getString(R.string.pk_pd), R.drawable.tab_chart,GraficaActivity.class);
        addTab(getString(R.string.help), R.drawable.tab_help, AyudaActivity.class);
    }

    }

    private void addTab(String labelId, int drawableId, Class<?> c)
    {
        TabHost tabHost = getTabHost();
        Intent intent = new Intent(this, c);
        TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); 

        View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
        TextView title = (TextView) tabIndicator.findViewById(R.id.title);

        title.setText(labelId);
                ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
        icon.setImageResource(drawableId);

        spec.setIndicator(tabIndicator);
        spec.setContent(intent);

        tabHost.addTab(spec);
        //tabHost.setOnTabChangedListener(this);

    }

    private void addTab2(String labelId, int drawableId, Class<?> c)
    {
        TabHost tabHost = getTabHost();
        Intent intent = new Intent(this, c).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); 

        View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
        TextView title = (TextView) tabIndicator.findViewById(R.id.title);

        title.setText(labelId);
                ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
        icon.setImageResource(drawableId);

        spec.setIndicator(tabIndicator);
        spec.setContent(intent);

        tabHost.addTab(spec);
        //tabHost.setOnTabChangedListener(this);
    }


    //@Override
    //public void onTabChanged(String tabId) {

    //  if (tabId.equals("tabPK/PD")==true && (((iTIVAapp)getApplication()).cambio==true)){ 
    //    LocalActivityManager manager = getLocalActivityManager();
    //    manager.destroyActivity("tabPK/PD", true);
    //   manager.startActivity("tabPK/PD", new Intent(this, GraficaActivity.class));
    //  }
    //}


}

ObjetivosActivity.java

package com.raigo.itivamin;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.NumberPicker;
import android.widget.NumberPicker.OnValueChangeListener;
import android.widget.Toast;

public class ObjetivosActivity extends Activity implements OnValueChangeListener {

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

        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        if (((iTIVAapp)getApplication()).modelo2.equals("halogenado")==false){
        setContentView(R.layout.objetivospage_sep);
        }
        else    
        {
        setContentView(R.layout.objetivospage_bal);
        }                   

        //valores por defecto
        ((iTIVAapp)getApplication()).Tinduccion=5;     
        ((iTIVAapp)getApplication()).tcx=180;
        ((iTIVAapp)getApplication()).objetivo="efecto";
        //((iTIVAapp)getApplication()).deltainfusion=15;
        ((iTIVAapp)getApplication()).cambio=true;

        final Button btn_opt = (Button)findViewById(R.id.button_optimizar);

        if (((iTIVAapp)getApplication()).mezclado==true){
             btn_opt.setVisibility(View.VISIBLE);

        } else if (((iTIVAapp)getApplication()).modelo2.equals("halogenado")==false) {
             btn_opt.setVisibility(View.GONE);
        }

        /////////
        final Button btn_ind = (Button)findViewById(R.id.button_induccion);
         btn_ind.setText((int)((iTIVAapp)getApplication()).Tinduccion+" "+getString(R.string._min));
        //se crean los objetivos del farmaco 1

         final NumberPicker np_ini1 = (NumberPicker) findViewById(R.id.numberPicker_ini1);
         final NumberPicker np_man1 = (NumberPicker) findViewById(R.id.numberPicker_man1);
         final NumberPicker np_sal1 = (NumberPicker) findViewById(R.id.numberPicker_sal1);

        String[] nums = new String[120];

        for(int i=1; i<nums.length+1; i++)
           nums[i-1] = Double.toString(i/10.0);

        np_ini1.setMaxValue(nums.length-1);
        np_ini1.setMinValue(0);
        np_ini1.setDisplayedValues(nums);
        np_ini1.setValue((int) (((iTIVAapp)getApplication()).ini1*10-1));
        np_ini1.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        np_ini1.setOnValueChangedListener(this);

        np_man1.setMaxValue(nums.length-1);
        np_man1.setMinValue(0);
        np_man1.setDisplayedValues(nums);
        np_man1.setValue((int) (((iTIVAapp)getApplication()).man1*10-1));
        np_man1.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        np_man1.setOnValueChangedListener(this);

        np_sal1.setMaxValue(nums.length-1);
        np_sal1.setMinValue(0);
        np_sal1.setDisplayedValues(nums);
        np_sal1.setValue((int) (((iTIVAapp)getApplication()).sal1*10-1));
        np_sal1.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        np_sal1.setOnValueChangedListener(this);

        if (((iTIVAapp)getApplication()).modelo2.equals("schnider") && ((iTIVAapp)getApplication()).mezclado==false){
        //se crean los objetivos del farmaco 2

            final NumberPicker np_ini2 = (NumberPicker) findViewById(R.id.numberPicker_ini2);
            final NumberPicker np_man2 = (NumberPicker) findViewById(R.id.numberPicker_man2);
            final NumberPicker np_sal2 = (NumberPicker) findViewById(R.id.numberPicker_sal2);

        String[] nums2 = new String[80];

        for(int i=1; i<nums2.length+1; i++)
           nums2[i-1] = Double.toString(i/10.0);

        np_ini2.setMaxValue(nums2.length-1);
        np_ini2.setMinValue(0);
        np_ini2.setDisplayedValues(nums2);
        np_ini2.setValue((int) (((iTIVAapp)getApplication()).ini2*10-1));
        np_ini2.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        np_ini2.setOnValueChangedListener(this);

        np_man2.setMaxValue(nums2.length-1);
        np_man2.setMinValue(0);
        np_man2.setDisplayedValues(nums2);
        np_man2.setValue((int) (((iTIVAapp)getApplication()).man2*10-1));
        np_man2.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        np_man2.setOnValueChangedListener(this);

        np_sal2.setMaxValue(nums2.length-1);
        np_sal2.setMinValue(0);
        np_sal2.setDisplayedValues(nums2);
        np_sal2.setValue((int) (((iTIVAapp)getApplication()).sal2*10-1));
        np_sal2.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
        np_sal2.setOnValueChangedListener(this);
        }
        else if (((iTIVAapp)getApplication()).mezclado==true){
             //se crean los objetivos del farmaco 2

            final NumberPicker np_ini2 = (NumberPicker) findViewById(R.id.numberPicker_ini2);
            final NumberPicker np_man2 = (NumberPicker) findViewById(R.id.numberPicker_man2);
            final NumberPicker np_sal2 = (NumberPicker) findViewById(R.id.numberPicker_sal2);

            String[] nums2 = new String[81];

            for(int i=1; i<nums2.length; i++)
               nums2[i-1] = Double.toString(i/10.0);

            nums2[80] = "-";

            np_ini2.setMaxValue(nums2.length-1);
            np_ini2.setMinValue(0);
            np_ini2.setDisplayedValues(nums2);
            np_ini2.setValue(80);
            np_ini2.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
            np_ini2.setOnValueChangedListener(this);

            np_man2.setMaxValue(nums2.length-1);
            np_man2.setMinValue(0);
            np_man2.setDisplayedValues(nums2);
            np_man2.setValue(80);
            np_man2.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
            np_man2.setOnValueChangedListener(this);

            np_sal2.setMaxValue(nums2.length-1);
            np_sal2.setMinValue(0);
            np_sal2.setDisplayedValues(nums2);
            np_sal2.setValue(80);
            np_sal2.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
            np_sal2.setOnValueChangedListener(this);    
        }
        else if (((iTIVAapp)getApplication()).modelo2.equals("halogenado")){
            NumberPicker np_mac = (NumberPicker) findViewById(R.id.numberPicker_mac);
            String[] nums2 = new String[30];

            for(int i=1; i<nums2.length+1; i++)
               nums2[i-1] = Double.toString(i/10.0);

            np_mac.setMaxValue(nums2.length-1);
            np_mac.setMinValue(0);
            np_mac.setDisplayedValues(nums2);
            np_mac.setValue(0);
            np_mac.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
            np_mac.setOnValueChangedListener(this);
        }


    }



    @Override
    protected void onResume() {
            super.onResume();

            NumberPicker np_ini1 = (NumberPicker) findViewById(R.id.numberPicker_ini1);
            NumberPicker np_man1 = (NumberPicker) findViewById(R.id.numberPicker_man1);
            NumberPicker np_sal1 = (NumberPicker) findViewById(R.id.numberPicker_sal1);


            np_ini1.setValue((int) (((iTIVAapp)getApplication()).ini1*10-1));
            np_man1.setValue((int) (((iTIVAapp)getApplication()).man1*10-1));
            np_sal1.setValue((int) (((iTIVAapp)getApplication()).sal1*10-1));


            if (((iTIVAapp)getApplication()).modelo2.equals("halogenado")==false){
                NumberPicker np_ini2 = (NumberPicker) findViewById(R.id.numberPicker_ini2);
                NumberPicker np_man2 = (NumberPicker) findViewById(R.id.numberPicker_man2);
                NumberPicker np_sal2 = (NumberPicker) findViewById(R.id.numberPicker_sal2);

                np_ini2.setValue((int) (((iTIVAapp)getApplication()).ini2*10-1));
                np_man2.setValue((int) (((iTIVAapp)getApplication()).man2*10-1));
                np_sal2.setValue((int) (((iTIVAapp)getApplication()).sal2*10-1));

                if (((iTIVAapp)getApplication()).mezclado==true){

                    if (((iTIVAapp)getApplication()).ini2==0 && ((iTIVAapp)getApplication()).man2==0){
                        np_ini2.setValue(80);
                        np_man2.setValue(80);   
                    } else {
                    np_ini2.setValue((int) (((iTIVAapp)getApplication()).ini2*10-1));
                    np_man2.setValue((int) (((iTIVAapp)getApplication()).man2*10-1));
                    }

                    np_sal2.setValue(80);
                }

            }

    }

.....
  • 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-18T12:37:54+00:00Added an answer on June 18, 2026 at 12:37 pm
    Caused by: java.lang.NullPointerException
         at com.raigo.itivamin.ObjetivosActivity.onCreate(ObjetivosActivity.java:25)
    

    The error seems to point to this line:

    if (((iTIVAapp)getApplication()).modelo2.equals("halogenado")==false){
    

    So either (iTIVAapp)getApplication() is null or .modelo2 is null. You can test which value is null with your debugger or via LogCat statements.

    If modelo2 may or may not be null you can write your condition backwards:

    if(!"halogenado".equals(((iTIVAapp)getApplication()).modelo2)){ 
        // "!" means "!= true" which must mean "false" for a boolean 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My App works without any problem locally, but as soon as I push it
I have simple app in my project. This app works without any problem. I
My app works well most of the time. The problem arises when I go
My app works when initially run, however if it is left in the background
My app works with the Devise gem for authentication, but I want customize it
My app works fine in the simulator but when I run it on my
My app works perfectly fine in the simulator but crashes on the Device. How
Let's say my app works but I love to learn and to find the
I have one web app works perfectly under linux with jetty-6.1.22. However, when I
can someone tell me why my app works fine on samsumg galaxy nexus but

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.