Android :: Service Interacting With Multiple Activities

Jun 29, 2010

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 activity. Activity 2 will be invoked when the user clicks a button on Activity 1. Activity 2's data also comes from the DataThread.

My idea is to put the logic of my DataThread inside an Android Service (DataService). My question is - can more than on activity bind to my DataService at the same time? Is there a way to tell the service to provide data to a specific activity only?

Android :: Service interacting with multiple activities


Android :: Multiple Activities Binding To A Service

Aug 3, 2010

I have a service component (common task for all my apps), which can be invoked by any of the apps. I am trying to access the service object from the all activities, I noticed that the one which created the service [startService(intent)] has the right informaion. But rest does not get the informaion needed.

My Code is as below:

CODE:................

If I invoke startService(intent). it creates a new service and runs in parallel to the other service.

If I don't invoke startService(intent), serviceObj.getData() retuns null value.

View 1 Replies View Related

Android :: Bind Service To Multiple Activities Advice

May 19, 2010

I'm new to Android development and am working on a small test project. I have a service, which communicates with an SQLite3 database, and two activities. A main activity which fetches database information via the service and displays it and a second activity which allows me to add data to the database via the service.

Currently, I have a singleton class which implements the ServiceConnection interface and I'm binding this to the service in the the main activity using the bindService function. Because it's a singleton, I can then use this service connection in both the main activity and second activity to work with the database and it all seems to work quite well.

However, I'm all the time aware that the service connection is bound to the main activity and I'm wondering if this is the wrong/bad way to do it? Would I be best off having two service connections, one in each activity, and binding each to the service?

View 2 Replies View Related

Android :: Handling Events From One Service For Multiple Activities

Jun 10, 2010

I have a class A which extends TabActivity and creates Activities B, C and D as tabs in its onCreate() function. Also, class A initializes another service handler class S which is responsible for establishing a connection to a service and implementing callback handlers for the service. Any of the Activities B, C and D should be able to receive events from the service and update accordingly. If I receive any event in class S from the the service then I want to call a function in Activity B which would be responsible to update the UI elements in Activity B based on the event received. You can assume that the user is in Activity B when the event arrives.

Can I call an activity function like the following in the stub handler for the callback in my class S -

CODE:................

View 4 Replies View Related

Android :: One Local Service Multiple Binding Activities

Nov 20, 2010

I have a local Service to which multiple activites needs to bind. In the first launched Activity, bindService returns true and onServiceConnected is called. But in any additionally launched activites bindService returns false, and I can't get a reference to my Service.

How can multiple activities simultaneously be connected to a local Service?

View 3 Replies View Related

Android :: Want Connected To Phone Service Between Multiple Activities?

Jan 15, 2010

I have multiple activities and one service.. In MainActivity I successfully connect to service (using a class what implements ServiceConnection + bindService() + startService()) but when i try to apply same method in other activity i see in LogCat a error... It Is possible to connect to service in an other way: something like to make static my CounterServiceConnection object in MainActivity and use it in the second one?

View 2 Replies View Related

Android :: Pros - Cons Of Multiple Activities In An App Vs One Activity - Multiple Views

Aug 16, 2010

Are there design guidelines to help decide if an application with multiple views should be designed with multiple activities or just one activity and control the back button itself.

I've tried both. My most complex applications using one activity per screen. However, now that I'm successfully written an app with just one activity and handling the back button myself, I don't see any compelling reason to use multiple activities. The one activity application is much simpler and more straightforward.

What advantages of multiple activities am I missing?

View 8 Replies View Related

Android :: Use Multiple Activities Or Multiple Content Views

Feb 18, 2010

I'm working on an application using xml layouts.

I wish to know which is better:
1. Use few activities and change its contentview
2. Use an activity for each 'view' needed

If both works, in which case which option would be better?

View 1 Replies View Related

Android :: Should App's With Multiple Layouts Have Multiple Activities To Handle Each

Jul 1, 2010

I'm planning to develop and app that presents the users with several different screens (of different information).
Was wondering what would be the best way to implement this?

Is it better to have separate XML layouts and an activity to display and allow the user to interact with each screen of data?

OR would handling all of these in the same activity be more efficient (and dynamically load / unload each layout)?

View 2 Replies View Related

Android :: App With Multiple Activities

Feb 8, 2010

I have a very simple game that consists of only one activity, and I want to add a title screen.If the title screen is another activity, what changes do I need to make to my manifest file to make the title screen open first?The gameplay activity is called Leeder, and the title screen activity is called LeederTitleScreen.

View 1 Replies View Related

Android :: Activities And Multiple Views

Aug 3, 2010

I start a browser and from the browser,I start a video which occupies only a small part of the screen,say the bottom right corner.

Now the browser will be pushed to the 2nd position in the window order and Video will come to the first position. Is it possible that browser can have the control for active window and receive the key events though the video is the Top Most window.

View 4 Replies View Related

Android :: Run Multiple Activities Simultaneously

Aug 30, 2010

I have buil a file explorer just like a mycomputer.it reads the whole storage and system for files and directories now.i am working with start menu.i have built it in an other activity i wan to make them active at the same time?

View 2 Replies View Related

Android :: Thread In Multiple Activities

Aug 23, 2009

I have started a thread from one Activity and then i have started another activit from parent Activity . Now my Parrent Activity is in pause state . but what will happen to thread that I have started from parrent . I belive it will continue........not going in sleep state........

View 2 Replies View Related

Android :: Multiple Activities In Application

Mar 17, 2010

I seem to be missing something obvious here, why would I want more than one activity per application in Android? Does somebody have some solid examples?

View 3 Replies View Related

Android :: How To Use Multiple Map Activities / Views?

Jul 31, 2010

My situation is the following: I have written one MapActivity class that is able to display a set of places as well as single places. On startup, the application creates an instance of this MapActivity and displays multiple places. If the user clicks on a certain place, then a new Activity is launched that shows the details of the selected place. This activity has a menu item that allows the user to view the place on a map - this causes that a new instance of the MapActivity is created, except that now only this single place is displayed.

The problem now is that if the user navigates back to the first MapActivity (the one that shows multiple places) the tiles won't be loaded anymore + sometimes OutOfMemoryErrors are encountered. According to the Android JavaDocs, it is only possible to have one MapActivity per process. However, I don't want to define my MapActivity as a singleInstance/singleTask, since the user should always be able to navigate back to the first MapActivity that shows multiple places. I have seen that the Google Places app (which has come with Google Map 4.4) for Android uses multiple MapActivity instances. How is this possible?

View 1 Replies View Related

Android :: Multiple OpenGL Activities

Mar 18, 2010

I'm having a problem when I create a Sub-Activity to my main activity. Both activities have their own GLSurfaceViews. Nothing on Logcat. Basically It just opens up the new view and it's black and it never renders with the new opengl stuff. I've tried a bunch of stuff, just want to know if there's some special way I need to pause the first opengl activity to get the second to run, or if there's some toggle which I am missing, or if it just can't be done. When I open the second activity with a GLSurface View, the first activity stops drawing frames, but the second one, never initializes or starts to draw.

Main Activity Creation:

CODE:................

View 3 Replies View Related

Android :: Timer Across Multiple Activities

Jun 28, 2010

i have an android app with several activities. I need to start a timer when the first activity starts and end the timer when the last activity starts and show the elapsed time. How can i use Asynctask to do this.

View 2 Replies View Related

Android :: Running Multiple Activities

Jun 23, 2010

I have developed a simple android application, which when started opens a Timer. User is given two buttons, start/ pause. This is working fine.What i want to do is to add a way to support multiple timers when a user swipes his finger on the screen.When he swipes from left to right, a new timer should show up, but the previous timer should not stop. This is a way to add multiple timers.Also, when he swipes from right to left, i want a previous timer to show.This is what i have done so for. I have a timer activity. I have added a touch event on it. When, a person swipes his finger, i get the co-ordinates and decide whether its from left to right or right to left.This functionality is working fine, as i can see the appropriate log messages.The problem is when I'm trying to load Timer Activity.It just loads the previous Activity and doesn't really create a new one (I figured this from the timer).Is there any way to do it?

View 1 Replies View Related

Android :: Use One Object In Multiple Activities Within My App?

May 25, 2010

I need to be able to use one object in multiple activities within my app, and it needs to be the SAME object. What is the best way to do this?

I have tried making the object "public static" so it can be accessed by other activities but for some reason this just isn't cutting it. Are there any other ways of doing this?

View 6 Replies View Related

Android :: Multiple Choice Dialogs - Activities

Apr 26, 2010

I have tried to make a series of dialogs, like a questionnaire, that the user needs to answers a series of questions selecting one or more checkboxes. I can do one, just fine, but when I try to make more than one question (lets say 10), it does not show, or show all the dialogs. I tried using dialogs or new acitivities.

So, my problem is I have multiple questions, one to be presented each time, and I need to wait for one to be responded so I can ask the next one. How do I accomplish this?

My first attempt was with a dialog box... but obviously it got all the boxes stacked in each other:

CODE:.................

View 4 Replies View Related

Android :: Want Multiple Activities In A Single View

Nov 19, 2010

Were looking into Android for writing a tablet based system. Part of the design is for the system to be as modular as possible. One aspect of this is to display any "STATUS" activities in a side view on the screen. It looks like I can use PackageManager queryIntentActivities() to find the activities that show status information. But, can I display these in a single view all at the same time (via a linear layout)? The activities would be installed in separate apk's (features). Can this be accomplished using ActivityGroup? Is this even allowed in Android? Everything I've read implies that Activities take the whole screen or float on top. This implies only one activity can be active at a time where as the design I'm thinking of uses the activities more like widgets.

View 1 Replies View Related

Android :: Displaying Multiple Activities On Same Screen

Mar 25, 2010

is it possible to show two activies on same screen at a time.and each activity is showing data which changes with time.

View 1 Replies View Related

Android :: How To Test Phone App Across Multiple Activities?

Nov 18, 2009

We are building a complex Android application consisting of many screens and workflows spread across many Activities. Our workflows are similar to what you might see on a Bank's ATM machine, for example, there is an Activity to login in that transitions to a main menu Activity which can transition to other activities based on the user's choices. Since we have so many workflows we need to create automated tests that span multiple activities so we can test a workflow from end to end. For example, using the ATM example, we would want to enter a valid PIN, verify that sends us to the main menu, choose withdraw cash, verify that we are on the withdraw cash screen, etc., etc., and eventually find ourselves back on the main menu or "logged" out. We've toyed with the test APIs that come with Android (e.g. ActivityInstrumentationTestCase2) and also with Positron, but neither seem capable of testing beyond the bounds of a single Activity, and while we can find some utility in these tools for some unit testing, they won't meet our needs for testing scenarios that cut across multiple Activities. We are open to an xUnit framework, scripting, GUI recorders/playbacks, etc. and would appreciate any advice.

View 9 Replies View Related

Android :: Make Variables And Multiple Activities?

Oct 12, 2010

How can I make a variable or object available to multiple activities or restarts of the same one.

View 1 Replies View Related

Android :: Showing Multiple Activities On One Screen

Sep 30, 2010

I have an interesting problem and I was looking for a solution; Hoping that someone here can help me out.(I did read through related questions on this topic but they have solutions which are not relevant to my situation).I have two activities. One is a simple list view to list available audio tracks. Another is a complex audio toolbar with controls to play/pause, ffd, and reviewing the currently playing audio.The audio toolbar uses a wrapper class that wraps the Android MediaPlayer object and this wrapper class is a singleton object. Which means that I eventually wish to use the audio toolbar anywhere in my app and control the singleton instance of my MediaPlayer wrapper.For this reason, I cannot have the audio toolbar and the audio listview in the same activity since I want the toolbar to be a separate entity altogether that pops up whenever the user wants to control the music, without having to see the listview.Now, since the user would pop up the toolbar from anywhere in the app, I would love to know of a way to combine the current activity and the toolbar activity into one screen.I do know that one option available to me is dialogs. I was looking for a more elegant solution where I could have the audio toolbar pop up at the bottom of the screen the user is on, without exiting the activity he is currently doing.Anyone know of a way to do this? I didn't come across anything for this in the docs but if someone does know, even pointing me to the correct docs would be extremely useful.

View 2 Replies View Related

Android :: Running Multiple Activities In For Loop One After Other

Oct 1, 2010

I have multiple activities in my android app and one final activity "All" which should run all the activities of my app one after the other. When I kept all my activities in for loop and used startactivity(intent) for each activity in that for loop, at the end I could see not all my activities being ran although all activities are finished. Any clue how to implement this?

View 3 Replies View Related

Android :: Managing Activities From Service

Jun 1, 2010

I have a service that listens to the serial port. According to data received from serial i switch between particular service states, and start particular activities on state transitions. I would like to accomplish it in following way: Let's assume there is one active Activity1 started from previous state, I call startActivity from service to start a new one Activity2, but I want to simulatenously destroy Activity1 when Activity2 gets on top of the stack. I tried to call finish() in Activity1.onStop but it seems not to work (Activity1.onDestroy() doesn't get called). I'd prefer to finish Activity1 after Activity2 gets on top in order to avoid blinking.

View 5 Replies View Related

Android :: How Many Activities Bound To Service

Sep 11, 2009

I have a service that's running in the background, is there any way (short of keeping a count of onBind() and onUnbind()) to know the number of activities that are bound to it?

I am trying to provide a "quit" function. all my activities derive from the same base class. I am keeping a global static around that says the "quit" button was pressed. then on each of the activities onResume() method, I look for the global static "quit" variable and if it's set to true, I call "finish()" so my activity shuts down, and then next activity on the task stack appears -- which goes through the same process of checking the global static "quit" variable until it gets to the root activity -- which effectively goes back to the main desktop screen.

However, I need a way to reset the global static "quit" variable, otherwise, when I launch the app again, it will check the global static quit variable and shutdown immediately - never coming back up. So, I want to know if there are any activities bound to my service, if not, I would set the global static "quit" variable back to false so that the app could be relaunched again.

View 2 Replies View Related

Android :: Service - Communicate With Activities

May 19, 2010

I'm wondering which is the best way to communicate between a Service and an activity..

Broadcast intent
Callback
others?...

View 1 Replies View Related

Android :: Service - Not Bound To Any Activities

Jun 5, 2010

I have an Android Service that I would like to keep running even after the last Activity has been popped off the stack, or the User has chosen to do something else.

Essentially the Service is listening for changes on a remote server, and I would like to generate a Notification if and only if an Activity from the app isn't running(or visible). In other words, I don't want the Notifications to occur while the User is directly interacting with the app.

In the case where the User is directly interacting with the app, the Service will notify the Activity and update appropriate UI elements based on the changes. I plan to implement this through the Observer pattern.

How can the Service know if none of apps Activities are bound to it?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved