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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:48:21+00:00 2026-06-08T06:48:21+00:00

so here is another basic problem i’m having…my application crashes as i try to

  • 0

so here is another basic problem i’m having…my application crashes as i try to pass a string to another activity. i have tried a few ways but in vain. here’s the code

Main Activity named Main.java

package com.ammad.test;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Main extends Activity {

    TextView tv;
    Button b1;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = (TextView) findViewById(R.id.tvShow);
        b1 = (Button) findViewById(R.id.bt1);
        b1.setOnClickListener(new View.OnClickListener() {

            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Bundle basket = new Bundle();
                String myScore = "testing";
                basket.putString("key", myScore);
                Intent intent = new Intent(Main.this, Second.class);
                intent.putExtras(basket);
                startActivity(intent);


            }
        });


    }
}

Second class to which the data is passes named Second.java

package com.ammad.test;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Second extends Activity{

    TextView tv;
    String getScore;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second);
        tv= (TextView) findViewById(R.id.tvRes);
        Bundle gotBasket = getIntent().getExtras();
        getScore = gotBasket.getString("key");
        tv.setText(getScore);
    }

}

and finally the manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ammad.test"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Main"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Sec"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="com.ammad.test.SECS" />
            </intent-filter>
        </activity>
    </application>

</manifest>
  • 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-08T06:48:22+00:00Added an answer on June 8, 2026 at 6:48 am

    Seems to me your second activity is declared wrong in the manifest, as .Sec not .Second as would be expected – the log is probably showing a exception because the intent was invalid.

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

Sidebar

Related Questions

I have very basic QT application (just create to explain my problem). So here
Before I get to my question/problem, here is the basic structure of my application:
I have a commit of this app up here The basic problem is, in
Here's yet another reverse error. The URLs work as expected. I have the basic
Here's another one for you to help me solve: I have an ASP.NET website
I must be retarded with searching, because here's another seemingly common problem that I
We are having another discussion here at work about using parametrized sql queries in
As indicated (by another poster) here: Can you pass a model with RedirectToAction? I
I have a basic problem but Google is not yielding many results for me
I have a problem here that still cannot solve, the thing is I have

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.