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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:43:10+00:00 2026-06-14T21:43:10+00:00

I am trying To Move Some Data From One Activity To another one. Using

  • 0

I am trying To Move Some Data From One Activity To another one.
Using Class Application

Projects Activities :

  • Main_Activity.

  • Second_Activity.


Main Activity Code

public class MainActivity extends Activity
{
    private ApplicationSettings application;
    private Button btn;
    private EditText txt1;
    private EditText txt2;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        txt1 = (EditText)findViewById(R.id.txt1);
        txt2 = (EditText)findViewById(R.id.txt2);
        btn = (Button)findViewById(R.id.btn);
        btn.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View arg0)
            {
                application = (ApplicationSettings)getApplication();
                application.setUserID(txt1.getText().toString());
                application.setUserName(txt2.getText().toString());
                Intent intent = new Intent(MainActivity.this,SecondActivity.class);
                startActivity(intent);
            }
        });
    }

    @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;
    }
}

=============================
Second Activity Code

public class SecondActivity extends Activity 
{

    private ApplicationSettings application;
    private TextView txt1,txt2;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

           application = (ApplicationSettings)getApplication();

           txt1 = (TextView)findViewById(R.id.txt1);
           txt2 = (TextView)findViewById(R.id.txt2);

           txt1.setText(application.getUserID().toString());
           txt2.setText(application.getUserName().toString());
    }
}

==============================
Application Class

public class ApplicationSettings extends Application
{


    String UserID;
    String UserName;

    public String getUserID()
    {
        return UserID;
    }
    public void setUserID(String userID)
    {
        UserID = userID;
    }
    public String getUserName()
    {
        return UserName;
    }
    public void setUserName(String userName)
    {
        UserName = userName;
    }

    @Override
    public void onCreate() {
        super.onCreate();

    }   
}

=============================

LogCat

11-25 15:32:31.695: E/Trace(17282): error opening trace file: No such file or directory (2)
11-25 15:32:31.960: D/libEGL(17282): loaded /system/lib/egl/libEGL_mali.so
11-25 15:32:31.965: D/libEGL(17282): loaded /system/lib/egl/libGLESv1_CM_mali.so
11-25 15:32:31.965: D/libEGL(17282): loaded /system/lib/egl/libGLESv2_mali.so
11-25 15:32:31.975: D/(17282): Device driver API match
11-25 15:32:31.975: D/(17282): Device driver API version: 10
11-25 15:32:31.975: D/(17282): User space API version: 10 
11-25 15:32:31.975: D/(17282): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Wed Sep 12 17:53:53 KST 2012 
11-25 15:32:32.000: D/OpenGLRenderer(17282): Enabling debug mode 0
11-25 15:32:32.005: E/SensorManager(17282): thread start
11-25 15:32:32.010: D/SensorManager(17282): registerListener :: handle = 0  name= LSM330DLC Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f68078
11-25 15:32:32.075: W/IInputConnectionWrapper(17282): showStatusIcon on inactive InputConnection
11-25 15:32:37.290: D/GestureDetector(17282): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 2 mFalseSizeCnt:0
11-25 15:32:37.295: D/SensorManager(17282): unregisterListener::  Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f68078
11-25 15:32:37.295: D/Sensors(17282): Remain listener = Sending .. normal delay 200ms
11-25 15:32:37.295: I/Sensors(17282): sendDelay --- 200000000
11-25 15:32:37.295: D/SensorManager(17282): JNI - sendDelay
11-25 15:32:37.295: I/SensorManager(17282): Set normal delay = true
11-25 15:32:37.300: D/SensorManager(17282): registerListener :: handle = 0  name= LSM330DLC Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f69650
11-25 15:32:37.315: W/IInputConnectionWrapper(17282): getSelectedText on inactive InputConnection
11-25 15:32:37.315: W/IInputConnectionWrapper(17282): setComposingText on inactive InputConnection
11-25 15:32:37.315: W/IInputConnectionWrapper(17282): getExtractedText on inactive InputConnection
11-25 15:32:41.350: D/SensorManager(17282): unregisterListener::  Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f69650
11-25 15:32:41.350: D/Sensors(17282): Remain listener = Sending .. normal delay 200ms
11-25 15:32:41.350: I/Sensors(17282): sendDelay --- 200000000
11-25 15:32:41.350: D/SensorManager(17282): JNI - sendDelay
11-25 15:32:41.350: I/SensorManager(17282): Set normal delay = true
11-25 15:32:41.620: W/IInputConnectionWrapper(17282): showStatusIcon on inactive InputConnection
11-25 15:32:46.200: D/SensorManager(17282): registerListener :: handle = 0  name= LSM330DLC Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f8b4c8
11-25 15:32:47.170: D/GestureDetector(17282): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 2 mFalseSizeCnt:0
11-25 15:32:47.175: D/SensorManager(17282): unregisterListener::  Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f8b4c8
11-25 15:32:47.175: D/Sensors(17282): Remain listener = Sending .. normal delay 200ms
11-25 15:32:47.175: I/Sensors(17282): sendDelay --- 200000000
11-25 15:32:47.175: D/SensorManager(17282): JNI - sendDelay
11-25 15:32:47.175: I/SensorManager(17282): Set normal delay = true
11-25 15:32:47.180: D/SensorManager(17282): registerListener :: handle = 0  name= LSM330DLC Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f8c6b8
11-25 15:32:47.210: W/IInputConnectionWrapper(17282): getSelectedText on inactive InputConnection
11-25 15:32:47.210: W/IInputConnectionWrapper(17282): setComposingText on inactive InputConnection
11-25 15:32:47.210: W/IInputConnectionWrapper(17282): getExtractedText on inactive InputConnection
11-25 15:32:50.470: D/GestureDetector(17282): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 2 mFalseSizeCnt:0
11-25 15:32:50.475: D/SensorManager(17282): unregisterListener::  Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f8c6b8
11-25 15:32:50.475: D/Sensors(17282): Remain listener = Sending .. normal delay 200ms
11-25 15:32:50.475: I/Sensors(17282): sendDelay --- 200000000
11-25 15:32:50.475: D/SensorManager(17282): JNI - sendDelay
11-25 15:32:50.475: I/SensorManager(17282): Set normal delay = true
11-25 15:32:50.480: D/SensorManager(17282): registerListener :: handle = 0  name= LSM330DLC Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@41f8b4c8
11-25 15:32:50.490: W/IInputConnectionWrapper(17282): getSelectedText on inactive InputConnection
11-25 15:32:50.490: W/IInputConnectionWrapper(17282): setComposingText on inactive InputConnection
11-25 15:32:50.490: W/IInputConnectionWrapper(17282): getExtractedText on inactive InputConnection
11-25 15:32:53.000: D/GestureDetector(17282): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 3 mFalseSizeCnt:0
11-25 15:32:53.160: D/AndroidRuntime(17282): Shutting down VM
11-25 15:32:53.160: W/dalvikvm(17282): threadid=1: thread exiting with uncaught exception (group=0x412862a0)
11-25 15:32:53.175: E/AndroidRuntime(17282): FATAL EXCEPTION: main
11-25 15:32:53.175: E/AndroidRuntime(17282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test01/com.example.test01.SecondActivity}: java.lang.NullPointerException
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.os.Looper.loop(Looper.java:137)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.ActivityThread.main(ActivityThread.java:4898)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at java.lang.reflect.Method.invokeNative(Native Method)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at java.lang.reflect.Method.invoke(Method.java:511)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at dalvik.system.NativeStart.main(Native Method)
11-25 15:32:53.175: E/AndroidRuntime(17282): Caused by: java.lang.NullPointerException
11-25 15:32:53.175: E/AndroidRuntime(17282):    at com.example.test01.SecondActivity.onCreate(SecondActivity.java:26)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.Activity.performCreate(Activity.java:5191)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
11-25 15:32:53.175: E/AndroidRuntime(17282):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
11-25 15:32:53.175: E/AndroidRuntime(17282):    ... 11 more
11-25 15:32:53.195: D/dalvikvm(17282): GC_CONCURRENT freed 180K, 9% free 12405K/13575K, paused 12ms+2ms, total 31ms

I need To Pass Data From the DditTexts on the main activity to the TextView in Second_activity

Thanks In Advance

Regards

  • 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-14T21:43:12+00:00Added an answer on June 14, 2026 at 9:43 pm

    As your Logs as :

    have you declared this activity in your AndroidManifest.xml?

    means make sure you have declared SecondActivity.class activity in AndroidManifest as :

    <Activity android:name=".SecondActivity" />
    

    if you have declared it then make sure it’s in same package or have same name as you have created in SecondActivity.java

    if you have SecondActivity in different Package then declare it in AndroidManifest as :

    <Activity android:name="<FULL_PACKAGE_NAME>.SecondActivity" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to insert some data from one table into another but I
Trying to move some divs using hover, this is my markup: <div class=item dark-grey>
I am trying to move dumped data from postgresql database to another. However, when
I am trying to move a WordPress installation from one server to another one,
I have some troubles trying to move data from SQL Server 2000 (SP4) to
I'm trying to move some Excel-Data to MySQL, but having troubles with encoding. What
I am trying to move from MySQL to MySQLi but am having some problems.
So I am trying to move selected rows from 1 table to another in
I'm trying to pull some binary data from a database and write them to
I am trying to extract data from website using Perl API. I am using

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.