activity

Android, activity for each view mode? Or switch statements inside fewer Activity classes?

I know how to functionally do each of the following scenarios, my main question is which is the better design decision? Based on app size/speed and battery life and such. So I will have several activities that will display different lists. They're all lists of the same object, but the objects' states will be different in each of the lis...

Android passing data from Activity to BroadcastReceiver shows null

I've got an activity which uses an AlarmManager to call a BroadcastReceiver at a particular point in time. This all works fine, except when I try to add some extra strings to the intent when calling the BroadcastReceiver, they always come up as null on the other end. Activity code: Intent intent = new Intent(this, ScheduleReceiver....

Android MediaPlayer - only one instance at any given time?

I have a audio player app, where there is a Main activity that shows 3 audio sample urls. On click on one, it goes to a Details Activity, which has a play and pause button, to start and pause the audio. My problem is that, when I start the Main activity, and say click on audio 1, I hit play on Details activity. This starts the MediaPla...

Keeping a bluetooth connection across activities on Android

I have an application in which I am going to be ransferring data via a bluetooth connection. In my proof of concept app, I was able to put the bluetooth communication in a different thread and keep all of my other work on the same activity (using ViewFlipper). However, for my next iteration, I will need to use several different "screen...

ACTION_SENDTO for sending an email

I am experiecing "This action is not currrently supported" error condition when I do the following? I am using 2.1. Anybody knows what I am doing wrong here? public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SENDTO); Uri uri = Uri.parse("mailto:[email protected]"); intent.setData(uri); intent.putExtra("subje...

Open the options menu programatically

I like to call a menu already created an activity without using the button on the smartphone. How can I do it? ...

How to detect if any of my activity is front-most and visible to user?

I would like to launch an intent when any of my activity is visible, otherwise I will put it up as a notification, and will be fired by the user. To decide this, I need to know if any of my activity is front-most, how do I that? ...

Android Service interacting with multiple activities

I'm trying to refactor/redesign an Android app. Currently, I've one UI activity (Activity 1) that creates a DataThread. This thread is responsible for network I/O and interacts (provides data) with the UI activity via a handler. Now, I want to add another activity (a new UI screen with Video) - Activity 2. Activity 1 is still the main ...

Android - How To Override the "Back" button so it doesn't Finish() my Activity?

I currently have an Activity that when it gets displayed a Notification will also get displayed in the Notification bar. This is so that when the User presses home and the Activity gets pushed to the background they can get back to the Activity via the Notification. The problem arises when a User presses the back button, my Activity ge...

Can I pass data through a new Activity?

In my Android app, I start a new activity with startActivityForResult(). I get the result in onActivityResult() perfectly. My problem is that there is a small bit of data that I know before I start the activity and I need that value to be available in onActivityResult(), too. I tried attaching it to my intent as an extra, but it wasn't a...

Android - Can a Service report back to calling Activity with status

Is there a way that a Service can report back to the calling activity when the Service has reached a particular stage of processing? For eg: Consider a music player activity that initiates the actual music playing in the background as an Android Service. I want to detect and inform the Activity when the Service has reached the Mediapla...

How to detect if view's parent activity is being destroyed.

I want to do some cleanup in a view when the activity is being destroyed. Is there any way to get a callback in the View when the activity is being destroyed? I tried using onDetachedFromWindow, but I'm not sure whether it is correct thing to do. ...

How to clear Intent that started Activity?

At the beginning Activity is launched by an Intent and something is done with this Intent. When I change orientation of my Activity, it's reloaded again and Intent is passed to the Activity. How can I clear that Intent to prevent Activity from using it again? I've tried setIntent(null), but with no result. ...

Is there any concept for activity tracking from a conceptual perspective during programming time?

I would like to learn what kind of real time activity/problem tracking methods people use. Let me clarify what I mean: When programming, I usually take a note for the current problem that I try to solve. I write down a sentence to name the problem. During research or debugging, I come across several alternative solution ideas that might...

Pausing a Thread - Activity pause timeout for HistoryRecord

I'm trying to write a game engine in Android, but I don't have much familiarity with threads. My thread has an attribute, mSurfaceHolder, which holds the surface that I'll be drawing to. The run() method for my thread looks like this: public void run() { // We're running now setState(STATE_RUNNING); // Keep looping while t...

(Android) Passing Resources/activities with intent

I have a fully functioning program that worked. However it had two dialogs that I know I'll be reusing every time I write a program, or potentially multiple times per program. They are a EULA and an info page. So I've moved the two activities to their own project, however I don't want to have a standard EULA and info page obviously. ...

Android Activity bind to Service

I have a series of 3 activities, and the 3rd activity binds (I'm using AIDL) to a Service. What I notice is, if I am on the 3rd activity and start the service, on clicking the back button (moving from 3rd activity to 2nd activity), the Service onDestroy() gets called, and the Service is stopped. How can I ensure that the service runs e...

Binding a Service to an android.app.Activity vs Binding it to an android.app.Application

Is there any fundamental difference in binding a service to an android.app.Activity vs binding it to an android.app.Application. I want to bind the service to an Application because I want to keep some global state/data in the Application instead of duplicating it in all my activities. Thanks. ...

Activity layout inheritance

Hi! I start develop application on Android! I need to show common control on the top of few screens. In Blackberry I just inherit my screens from base screen with needed controls and it inherit UI and behaviour from base type. How can i do similar thing in Android? I mean, how can i organize it? Maybe, i need to create control or layout...

Android ActivityGroup Menu Problem

I have one problem using ActivityGroup. I have two activities inside an ActivityGroup and both of them use a menu (overriding the onCreateOptionMenu and onOptionsItemSelected). Well, the problem is that the second activity in the group doesn't show the menu when I press the menu Key. The first activity works fine showing the menu. Any ...