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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:39:08+00:00 2026-06-12T14:39:08+00:00

I am a beginner of Android. I want to pass the result from FirstActivity

  • 0

I am a beginner of Android. I want to pass the result from FirstActivity to the SecondActivity as below. How to remove results in intent extra? Or any way to pass the result to SecondActivity and show on the TextView?
(I have make a mistake and replace, my main question is how to delete the result, because i want to set another new result in it.)

FirstActivity.java

    public class FirstActivity extends Activity {   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //code...
        try {     
            myDbHelper.createDatabase();
        } 
        catch (IOException ioe) {
        Log.d("Error","Error while createing Database");
        ioe.printStackTrace();
        throw new Error("Unable to create database");
        }   
        try {     
            myDbHelper.openDataBase();     
        }
        catch(SQLException sqle){
            Log.d("Error","Error while Opening Database");
            sqle.printStackTrace();
            throw sqle;     
        }
        send.setOnClickListener( new View.OnClickListener() {  
        public void onClick(View v) {  
        showResult();  
    }  
    });             
    }
    private void showResult() {  
        //...code       
        //checking for slection 
        results = queryData(table, type);               
        Intent intent = new Intent(this,SecondActivity.class);      
        intent.putExtra("results", results);  
        startActivity(intent);
    }
    public String queryData(String table, String type){
        //...
        //do somthing to get result
        return result;
    }
    }  

SecondActivity.java

    public class SecondActivity extends Activity {      
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);                    
        setContentView(R.layout.result_item);        
        TextView tv;        
        tv = (TextView)findViewById(R.id.tv);       
        Bundle extras=getIntent().getExtras();
        String value1=extras.getString("results");      
        tv.setText("Result\n" + value1);
    }
    }
  • 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-12T14:39:09+00:00Added an answer on June 12, 2026 at 2:39 pm

    You can do in 2 ways:

    1. You can use startActivityForResult(), onActivityResult() from the Activity A, to pass the data on to Activity B, then after some computation, passing the result back to Activity A.

    2. Now if you want to just send some data from Activity A to Activity B, and then display it in TextView, then use putExtra() and getExtras()…

    Sending from Activity A to B:

    Intent i = new Intent(Activity_A.this, Activity_B.class);
    i.putExtra("name",Name);
    startActivity(i);
    

    Receiving the value on Activity B:

    Intent i = getIntent();
    String n = i.getExtras().getString("name");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner in creating android applications, I want a cheap way to
I'm beginner in Android (and java), and I'm just playing around and want to
I'm just a beginner with android. I want to divide a bitmap image into
I am a beginner in Android programming. I want to build a simple application
I am a Java beginner , I want to develop Android app , what
I am a beginner in Android programming and would want to display text entered
I'm a beginner in android. Now i'm working on a simple app. I want
I'm just a beginner with Android. I want the button to change its color
Hello I am beginner to the android development. I want to create a tab
I am beginner in android, I just want to know how to get the

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.