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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:36:33+00:00 2026-05-30T06:36:33+00:00

public class Activity1 extends Activity { billreminder br;//billreminder is a function in activity2 public

  • 0

public class Activity1 extends Activity {

billreminder br;//billreminder is a function in activity2

public void onCreate(Bundle savedInstanceState);



setContentView(R.layout.main);

br.read(c);//c is a string

}

how do we call read function.

  • 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-05-30T06:36:35+00:00Added an answer on May 30, 2026 at 6:36 am

    There are a couple of ways you can do this. You can make the function in activity2 a static function. You can then call it like so: Activity2.read(c)

    Another way, is to pass an intent from Activity1 to Activity2 as follows:

    in activity1:

    Intent intent = new Intent(Activity1.this, Activity2.class);
    intent.putExtra("c", c);
    //this will put a callback in the onActivityResult method for the Activity1 class
    startActivityForResult(intent, requestCode);//requestCode is an int
    

    in activity2 inside its onCreate method:

    Bundle extras = getIntent().getExtras();
    
    if(extras != null) {
        c = extras.getString("c");
        if(c != null && !"".equals(c)) {
            read(c);
        }
        setResult(resultCode);//resultCode is an int
    }
    

    in activity1 again1:

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       super.onActivityResult(requestCode, resultCode, data);
       //detect resultCode or requestCode, and do whatever you want
       ....
    }
    

    Avoid subclassing the Application class. From the android docs:

    There is normally no need to subclass Application. In most situation,
    static singletons can provide the same functionality in a more modular
    way. If your singleton needs a global context (for example to register
    broadcast receivers), the function to retrieve it can be given a
    Context which internally uses Context.getApplicationContext() when
    first constructing the singleton.

    Also, I think you are confused. You need to call a method on an object.

    billreminder br;//billreminder is a function in activity2

    is wrong. I think you meant that br is an object.

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

Sidebar

Related Questions

public class Test { public static void main(String[] args) { } } class Outer
public class doublePrecision { public static void main(String[] args) { double total = 0;
public class WrapperTest { public static void main(String[] args) { Integer i = 100;
public class Main3 { public static void main(String[] args) { Integer min = Integer.MIN_VALUE;
I have an android activity in which I'm using tabs. public class UnitActivity extends
i have executed the following code public class Activity_Threads_Handler extends Activity { private int
Here is my Activity class public class A extends Activity { ....... ....... //here
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.RelativeLayout; public class
I have a list of objects called Activity: class Activity { public Date activityDate;
public class MyClass { public int Age; public int ID; } public void MyMethod()

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.