76172

Calling one Activity from another

Question:

How can I call another activity from one (the current) activity? I want to call an activity which contains a dialog message box from my current activity.

Answer1:

Simply put your message in bundle and pass it to intent. On Next Activity's onCreate function extract the bundle and show.

Bundle b = new Bundle(); b.putString("message","your message"); Intent i = new Intent(this,NextActivity.class); i.putExtras(b); startActivity(i);

In next Activity's onCreate:

String message = (String) getIntent().getSerializableExtra("message");

show the message now....

Answer2:

Intent i = new Intent(this, AnotherActivity.class); startActivity(i);

Answer3:

Intent i=new Intent(yourpresentactivity.this, nextactivity.class); startActivity(i);

Recommend

  • Is Android's ARGB_8888 Bitmap internal format always RGBA?
  • How to force refresh on CallLog.Calls.CACHED_NAME column?
  • OnItemSelectedListener for Spinner that was added programmatically does not trigger
  • Receive custom intent without activity restart
  • dismiss Progress Dialog in another Activity … Android
  • How to change placeholder text in an autocomplete activity of android google place?
  • Replace Fragment with another on back button
  • Send data from edittext to listview
  • EditText is covered by Keyboard
  • Avoid registering duplicate broadcast receivers in Android
  • How can go in last activity with resume button?
  • How to get listview position?
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • Creating a DropDownList
  • Who propagate bugfixes across branches (corporate development)?
  • URLConnection doesn't work since API 10 and higher?
  • Android application: how to use the camera and grab the image bytes?
  • Connect .sks to skscene.h
  • How to test if a URL from an Eclipse bundle is a directory?
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • Java: can you cast Class into a specific interface?
  • Scrapy recursive link crawler
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • Cannot Parse HTML Data Using Android / JSOUP
  • PHP: When would you need the self:: keyword?
  • Acquiring multiple attributes from .xml file in c#
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • unknown Exception android
  • Busy indicator not showing up in wpf window [duplicate]
  • reshape alternating columns in less time and using less memory
  • Binding checkboxes to object values in AngularJs
  • Why do underscore prefixed variables exist?
  • Net Present Value in Excel for Grouped Recurring CF
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?