All Questions

942
votes
37answers
644746 views

How do I pass data between Activities in Android application?

I have a scenario where, after logging in through a login page, there will be a sign-out button on each activity. On clicking sign-out, I will be passing the session id of the signed in user to sign-...
2097
votes
24answers
609530 views

Saving Android Activity state using Save Instance State

I've been working on Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example: package com.android.hello; i...
713
votes
8answers
489733 views

How to manage `startActivityForResult` on Android?

In my activity, I'm calling a second activity from the main activity by startActivityForResult. In my second activity there are some methods that finish this activity (maybe without result), however, ...
1164
votes
29answers
342796 views

Activity restart on rotation Android

In my Android application, when I rotate the device (slide out the keyboard) then my Activity is restarted (onCreate is called). Now, this is probably how it's supposed to be, but I do a lot of initia...
558
votes
31answers
472826 views

How to pass an object from one activity to another on Android

I am trying to work on sending an object of my customer class from one Activity and display it in another Activity. The code for the customer class: public class Customer { private String first...
729
votes
17answers
337537 views

How do I create a transparent Activity on Android?

I want to create a transparent Activity on top of another activity. How can I achieve this?
705
votes
31answers
505499 views

How to send an object from one Android Activity to another using Intents?

How can I pass an object of a custom type from one Activity to another using the putExtra() method of the class Intent?
635
votes
31answers
269091 views

onActivityResult is not being called in Fragment

The activity hosting this fragment has its onActivityResult called when the camera activity returns. My fragment starts an activity for a result with the intent sent for the camera to take a picture....
459
votes
17answers
590631 views

How to start new activity on button click

In an Android application, how do you start a new activity (GUI) when a button in another activity is clicked, and how do you pass data between these two activities?
545
votes
8answers
267059 views

Example: Communication between Activity and Service using Messaging

I couldn't find any examples of how to send messages between an activity and a service, and I have spent far too many hours figuring this out. Here is an example project for others to reference. This...

Previous Next