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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:41:51+00:00 2026-06-05T01:41:51+00:00

I am new to android. And write this program but get error. public class

  • 0

I am new to android. And write this program but get error.

public class First1Activity extends Activity {

    /** Called when the activity is first created. */

    public final static String x= "com.example.my.p";
    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
    }
    public void mess(View view) {
        Intent intent=new Intent(First1Activity.this,DisMess.class);
        EditText edittext = (EditText) findViewById(R.id.editText1);
        String m= edittext.getText().toString();
        intent.putExtra(x, m);
        TextView t=(TextView)findViewById(R.id.textView1);
        t.setText(m);

            First1Activity.this.startActivity(intent);


    }
    public class DisMess extends Activity{

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            Intent intent = getIntent();
            String message = intent.getStringExtra(First1Activity.x);
            TextView textView = new TextView(this);
            textView.setTextSize(40);
            textView.setText(message);
            setContentView(textView);

        }

    }

Now i get Error like::::::

Application has stop working…

I got error in line :First1Activity.this.startActivity(intent);

pls help

  • 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-05T01:41:56+00:00Added an answer on June 5, 2026 at 1:41 am

    Make sure you have declared DisMess activity in manifest.

    I have modified your code slightly.

    public class First1Activity extends Activity {
    
    public final static String key= "com.example.my.p";
    private Context context;
    
    @Override
    
    public void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        context=First1Activity.this;
    
    }
    public void mess(View view) {
    
        EditText edittext = (EditText) findViewById(R.id.editText1);
        TextView t=(TextView)findViewById(R.id.textView1); 
    
        String m= edittext.getText().toString();       
        t.setText(m);   
    
        Intent intent=new Intent(context,DisMess.class); 
        intent.putExtra(x, m);
        startActivity(intent);
    }
    
    
      public class DisMess extends Activity{
    
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                Intent intent = getIntent();
                String message = intent.getStringExtra(First1Activity.x);
                TextView textView = new TextView(this);
                textView.setTextSize(40);
                textView.setText(message);
                setContentView(textView);
    
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
I'm trying to implement my first android Program. It should write calendar entries (I
I tried a simple file write program in Android. try { //File f1=new File(/sdcard/Prag.txt);
I'm new in Android Programming. I'm trying to write an app that uses USB
I'm new to Android and SQLite, too. I'm trying to write a method where
At first my programm looks like this: But when i am moving the picture
I am very new to Android and OpenGL. I was asked to write an
I am new to Android and Eclipse development, but not new to software development
In my Android program, I have some code that downloads a file. This works
Through my Android program I wrote a file like this: String file = Environment.getExternalStorageDirectory().getAbsolutePath()

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.