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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:56:19+00:00 2026-06-03T15:56:19+00:00

this is my Manual.java file: public class Manual extends Activity implements OnClickListener{ Button create;

  • 0

this is my Manual.java file:

public class Manual extends Activity implements OnClickListener{
    Button create;
    TextView gotAnswer, NoAnsV;
    EditText NoQues, NoAnswer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.manualask);     
        NoQues = (EditText) findViewById (R.id.NoQues);
        NoAnswer = (EditText) findViewById (R.id.NoAnsw);
        create = (Button) findViewById (R.id.create);
        create.setOnClickListener(this);        
    }
    public void onClick(View v) {
        // TODO Auto-generated method stub      
        switch (v.getId()){     
        case R.id.create:
            Intent intent = new Intent(Manual.this, MCQSample.class);
            Bundle b = new Bundle();
            Integer Number = Integer.parseInt(NoQues.getText().toString());         
            intent.putExtras(b);
            startActivity(intent);
            finish();
            break;

    }
    }
}

Then the MCQSample.java:

public class MCQSample extends Activity{

    TextView title;
    String gotBread;
    int value;
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mcqsample); 
        title = (TextView) findViewById(R.id.abc);

        Bundle b = getIntent().getExtras();
        int value = b.getInt("key", 0);
        title.setText(value);
    }
}

Then the mcqsample.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center"
    android:orientation="vertical" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Text"
        android:id="@+id/abc"/>

</LinearLayout>

Both classes I have already added in the AndroidManifest.

When I click the create button on the Manual.java it always crashes. What wrong with my classes?

  • 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-03T15:56:21+00:00Added an answer on June 3, 2026 at 3:56 pm

    You don’t set the number to the bundle, you should call Bundle#putInt:

    Bundle b = new Bundle();
    Integer number = Integer.parseInt(NoQues.getText().toString());         
    b.putInt("key", number);
    intent.putExtras(b);
    

    The second problem (which causes the crash) is, that you should set text, not int:

    title.setText("" + value);
    

    Otherwise it looks for a string with the id = value, and such id doesn’t exist (see TextView#setText(int)).

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

Sidebar

Related Questions

According to the PHP manual , a class like this: abstract class Example {}
Is it possible to read different property groups from a Java file, without manual
I am trying to write a Java class to extract a large zip file
I have a java file called 'move.class' I want to make it into a
I have only started learning Java. My task is to create a file server
I can't login to github with generated ssh-keys. I've followed this manual: http://help.github.com/linux-key-setup but
JD Long helped me with this: question about manual annotation . But is it
I'm sure I've just missed this in the manual, but how do you determine
The manual does not answer this question : it says the name of the
The manual is unclear as to how to implement this (it assumes you already

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.