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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:57:27+00:00 2026-06-14T20:57:27+00:00

I am calling an activity from another activity via intents and passing values through

  • 0

I am calling an activity from another activity via intents and passing values through bundle(String values) but It could not start the activity this is the code and log cat errors please help me solve this

Activity which is calling another activity

if(v==btndate){
    Intent i2=new Intent(accounts.this,calcok.class);
        String frm=edtdate1.getText().toString();
        String to=edtdate2.getText().toString();
        Log.e("acc->calcok","inbetween intents");
        Log.e("from date",frm);
            Log.e("to date",to);
        i2.putExtra("from",(String)frm);
        i2.putExtra("to",(String) to);
        startActivity(i2);
}

Acitivity called by the previous one

package dlp.android.digichronicle;

import java.io.IOException;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Intent;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

public class calcok extends Activity{
DBHandandler  myDbHelper=new DBHandandler(this);
SQLiteDatabase Mydatabase;
float inc,exp;
String s1,s2,s3;
String stattionlist,DBname="widgets";

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.myDbHelper = new DBHandandler(this);
     Bundle b=getIntent().getExtras();
System.out.println("Got from acc"+b);
String frm=b.getString("frm");
String to=b.getString("to");
    if(b!=null)
    {

        Log.e("frm",frm);
        Log.e("to",to);
             Log.e("Entered accounts->" +"CALCCCC","");
             try {
                    FetchingData();
                    myDbHelper.openDataBase();

                    Mydatabase = myDbHelper.getWritableDatabase();

                    String s =second.ge;

                    if(s.equalsIgnoreCase("accounts")){
                ArrayList<Float> inclist=new  ArrayList<Float>();
                ArrayList<Float> explist=new ArrayList<Float>();
                        try{
                 explist =myDbHelper.calc(Mydatabase,"exp",frm,to);

                inclist =myDbHelper.calc1(Mydatabase,frm,to);
                         }
                         catch(Exception e){
                        inclist.add(500.0f);
                                explist.add(320.0f);
                         }
                float inc= sum(inclist);
                float exp= sum(explist);
                    float sav=inc-exp;
                    if(sav<0){
                        s3="Deficit Amount";
                        }
                        else
                        {
                            s3=Float.toString(sav);
                        }
                        s1=Float.toString(inc);
                        s2=Float.toString(exp);
                      }
           Toast.makeText(getApplicationContext(), "GOt Details",Toast.LENGTH_LONG).show();

             } catch (SQLException e) {
                 //TODO Auto-generated catch block
                e.printStackTrace();
            }
        myDbHelper.close();
        Mydatabase.close();
        Intent i3=new Intent(calcok.this,accounts.class);
       i3.putExtra("inc",s1);
       i3.putExtra("exp",s2);
       i3.putExtra("sav",s3);
        startActivity(i3);
       }

         }
 public static float sum(ArrayList<Float> list){
      if(list==null || list.size()<1)
        return 0;

      float sum = 0;
      for(Float i: list)
        sum = sum+i;

      return sum;
    }

private void FetchingData() {


     try {  myDbHelper.onCreateDataBase();

    } catch (IOException ioe) {

        throw new Error("Unable to create database");
    } 
    try {

        myDbHelper.openDataBase();
        Mydatabase = myDbHelper.getWritableDatabase();

    }catch(SQLException sqle){

        throw sqle;

    }

}
  }

Logcat errors

11-24 20:52:26.318: I/System.out(842): cursortrue
11-24 20:52:29.267: D/Testing(842): Checkpoint 2
11-24 20:52:29.647: D/dalvikvm(842): GC_FOR_ALLOC freed 9093K, 24% free 30100K/39303K, paused 91ms
 11-24 20:52:29.817: I/dalvikvm(842): threadid=3: reacting to signal 3
 11-24 20:52:29.837: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
 11-24 20:52:32.247: D/dalvikvm(842): GC_CONCURRENT freed 655K, 21% free 31399K/39303K, paused 5ms+23ms
 11-24 20:52:32.337: I/dalvikvm(842): threadid=3: reacting to signal 3
 11-24 20:52:32.366: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
 11-24 20:52:32.767: I/dalvikvm(842): threadid=3: reacting to signal 3
 11-24 20:52:32.797: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
 11-24 20:52:35.757: E/acc->calcok(842): inbetween intents
 11-24 20:52:35.847: I/System.out(842): Got from accBundle[mParcelledData.dataSize=64]
 11-24 20:52:35.847: D/AndroidRuntime(842): Shutting down VM
 11-24 20:52:35.858: W/dalvikvm(842): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
 11-24 20:52:35.897: E/AndroidRuntime(842): FATAL EXCEPTION: main
 11-24 20:52:35.897: E/AndroidRuntime(842): java.lang.RuntimeException: Unable to start   activity ComponentInfo{dlp.android.digichronicle/dlp.android.digichronicle.calcok}: java.lang.NullPointerException: println needs a message
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
  11-24 20:52:35.897: E/AndroidRuntime(842):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at and roid.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.os.Handler.dispatchMessage(Handler.java:99)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.os.Looper.loop(Looper.java:137)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.app.ActivityThread.main(ActivityThread.java:4424)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at java.lang.reflect.Method.invokeNative(Native Method)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at java.lang.reflect.Method.invoke(Method.java:511)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at dalvik.system.NativeStart.main(Native Method)
11-24 20:52:35.897: E/AndroidRuntime(842): Caused by: java.lang.NullPointerException: println needs a message
11-24 20:52:35.897: E/AndroidRuntime(842):  at android.util.Log.println_native(Native Method)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.util.Log.e(Log.java:231)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at dlp.android.digichronicle.calcok.onCreate(calcok.java:30)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at android.app.Activity.performCreate(Activity.java:4465)
 11-24 20:52:35.897: E/AndroidRuntime(842):     at an droid.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  11-24 20:52:35.897: E/AndroidRuntime(842):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  11-24 20:52:35.897: E/AndroidRuntime(842):    ... 11 more
   11-24 20:52:36.297: I/dalvikvm(842): threadid=3: reacting to signal 3
  11-24 20:52:36.317: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
  11-24 20:52:36.567: I/dalvikvm(842): threadid=3: reacting to signal 3
  11-24 20:52:36.576: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
  11-24 20:52:37.117: I/dalvikvm(842): threadid=3: reacting to signal 3
  11-24 20:52:37.137: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
  11-24 20:52:37.619: I/dalvikvm(842): threadid=3: reacting to signal 3
   11-24 20:52:37.647: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
   11-24 20:52:38.147: I/dalvikvm(842): threadid=3: reacting to signal 3
   11-24 20:52:38.177: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
   11-24 20:52:38.697: I/dalvikvm(842): threadid=3: reacting to signal 3
  11-24 20:52:38.707: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
  11-24 20:52:39.217: I/dalvikvm(842): threadid=3: reacting to signal 3
   11-24 20:52:39.237: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
   11-24 20:52:39.737: I/dalvikvm(842): threadid=3: reacting to signal 3
  11-24 20:52:39.757: I/dalvikvm(842): Wrote stack traces to '/data/anr/traces.txt'
  11-24 20:52:39.877: I/Process(842): Sending signal. PID: 842 SIG: 9
  11-24 20:52:41.037: I/dalvikvm(857): threadid=3: reacting to signal 3
  11-24 20:52:41.107: I/dalvikvm(857): Wrote stack traces to '/data/anr/traces.txt'
  11-24 20:52:41.246: D/dalvikvm(857): GC_FOR_ALLOC freed 70K, 3% free 9121K/9347K, paused 68ms
  • 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-14T20:57:28+00:00Added an answer on June 14, 2026 at 8:57 pm

    Your frm is null in the calcok Activity (As it very clearly states in Logcat).

    11-24 20:52:35.897: E/AndroidRuntime(842): Caused by: java.lang.NullPointerException: println needs a message
    11-24 20:52:35.897: E/AndroidRuntime(842):  at android.util.Log.println_native(Native Method)
     11-24 20:52:35.897: E/AndroidRuntime(842):     at android.util.Log.e(Log.java:231)
     11-24 20:52:35.897: E/AndroidRuntime(842):     at dlp.android.digichronicle.calcok.onCreate(calcok.java:30)
    

    So, I guess it’s the way you’re receiving the extras. Try:

    String frm = getIntent().getStringExtra("frm");
    String to = getIntent().getStringExtra("to");
    

    EDIT: Just realized you’re putting the extra as from, and receiving it as frm. That’s the error.

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

Sidebar

Related Questions

I am trying to pull in a string from one activity to another but
I am calling a PreferenceActivity from another activity and then updating the application state
My main activity My_Gallery is calling a function from another class DataCall. In DataCall
I am calling startActivity to pass data from one activity to another using an
I am calling a method of another class from my activity that calls a
I am starting another activity by calling startActivityForResult() and after pressing back button my
Calling the WriteObject Method from a background thread is not possible! Is there a
Assuming i want to open another activity from my current activity and i want
In my application, I start an activity, that is in another application (Eclipse project)
How do I start my app from my other app? (they will not be

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.