Android :: Asynchronous Service Call While Starting Activity

Jul 24, 2010

I am starting an activity from one by passing some data in the intent. I want the next activity to call some asynchronous service (rest service) with the data from intent and show the result on screen.

Android :: Asynchronous service call while starting activity


Android :: Updating Activity From Asynchronous Service

Apr 2, 2010

I've implemented a service that does an asynchronous sync between my application and google docs. I want to update the top level activity of my application when the sync is complete. However because of the service it's possible that the app could be be in a unknown state. Is there a way to make the top level activity, whatever that may be, recreate itself from an asynchtask in a service.

View 3 Replies View Related

Android :: Starting Activity From Service / Receiver?

Oct 27, 2009

I have a service that sometimes starts applications.The problem is: if the *previous app* (any app) was recently exited via the home key, then the following message appears in the log:ActivityManager: Activity start request from 10024 stopped.And there's then around a 5 second delay before the target app (any) is launched.If the previous app was exited with the back key, there's no problem.If the previous app exited more than a few second ago, no problem.The same also occurs with a broadcast receiver (which also requires the NEW_TASK intent flag to launch an activity).I don't know if the delay was there in 1.5, but I'm assuming not since I can't find the error message in the 1.5 source code.

View 5 Replies View Related

Android :: Widget Starting Service Also Starts Main Activity

May 3, 2010

I have a widget that is supposed to start and stop a service (start it when it's not running, stop it when it is). This is working fine, however, each time the service is started, my app's main activity is also launched, which I don't want from the app's manifest, it works as I want it to (without launching the main-activity, just the service), but then I obviously don't have a main activity anymore.This is how I start the service (I would assume this is the normal way, and I can't see any reference to what might cause the MAIN intent to fire).

View 1 Replies View Related

Android :: Starting Activity On UncaughtException() Call

Jul 14, 2010

I want to start a new activity from my UncaughtExceptionHandler when an uncaught exception appears. Is this possible?

I think the current activity can't start a new child activity in its "error" state because I always get this errors:

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

I tried to start the child activity from a new thread, because i thought the current thread might be in a state where it is not allowed to start a new activity but this didn't work too.

How do i prevent the current activity from blocking everything while in this error state? is the any way to set the exception to handled?

View 1 Replies View Related

Android :: MVC - Application Or Service For Asynchronous Updates

Jul 3, 2010

I have data that is to be refreshed from the Internet. Let's call it Model.

What I want to do: Basically it sounds like an MVC model, where the Model is also kept persistent in local (private) storage. The Model and its associated methods are application-wise. There are several Activity's that display and manipulate different aspects of it:

User
navigates across different Activity's
that display Model
from different perspectives. Currently I have a ListActivity for all elements, and an Activity for one element's details
Sometimes Model needs refreshing.
Surely this is done on a different thread. Refreshing can be triggered from several Activity's.
There are several (time consuming) common
tasks that can be triggered from different Activity's
My application loads and saves Model
to private storage when it starts
and stops

My problem: I'm not sure where to put Model and the related tasks in. Also, I don't know what mechanism to use to notify Activity's. Currently I come up with 2 approaches:

Use Service and send broadcasts. Saving to disk is performed in Service#onDestroyed(), so I want to minimize that by binding it to Activity's. At this point, I'm also not sure how to deliver the updated information: whether to provide a getter in Binder, or include that in the broadcast message.
Customize the Application object so that refreshing methods and getters are available globally. I then perform update from Activity's using AsyncTask. If there are other Activity's that are behind the current Activity, they will update in onResume() when the user navigates back.

Reasons I'm not using a class with static methods:

I need to save and store Model to disk. Some of the methods need a Context for displaying toasts, notifications, caching, etc.


Also, I don't put these functionalities in an Activity because there are several activities that manipulate the same piece of persistent data.

Below are pseudocode illustrating what I mean:

Using Service:

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

Make the functionality globally accessible in the custom Application object

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

Weaknesses I can think of for the Service approach is complexity, since Binding is asynchronous. And it's very likely that I have to repeat some code because I have both ListActivity and Activity

For the Application approach, the documentation says not to rely on onTerminate() being called.

View 3 Replies View Related

Android :: Testing An Asynchronous Activity

Dec 2, 2009

I'm using a web service disguised as a ContentProvider and AsyncQueryHandler to isolate my activity from the delays of transport. My question is: during testing, how can I determine when my activity has retrieved the data from the web service? That would be after onQueryComplete() in the AsyncQueryHandler has come back with the "real" data. During manual testing, I just sit there and wait until the view updates. How can I do that using ActivityUnitTestCase and ActivityInstrumentationTestCase2?

View 2 Replies View Related

Android :: Kill Activity From Asynchronous Thread?

Sep 27, 2010

How can I kill Android activity from asynchronous thread? In my android application, I start another activity using startActivity. Is there anyway for me to kill that activity I started after several minutes?Or is there any way beside using thread?

View 2 Replies View Related

Android :: How To Call Function Of Activity From A Service?

May 16, 2010

I have an Activity (A) and a Service (S) which gets started by A like this:
Intent i = new Intent();
i.putExtra("updateInterval", 10);
i.setClassName("com.blah", "com.blah.S");
startService(i);
A have a function like this one in A: public void someInfoArrived(Info i) Now I want to call A.someInfoArrived(i) from within S. Intent.putExtra has no version where I could pass an Object reference etc.

View 1 Replies View Related

Android :: Want Call Methods Of A Activity From Service

Apr 27, 2009

Is it possible to call methods of a Activity from service. I am running a thread from a service and i listening to some external event from that thread. I am not able to call methods from that thread. Is there any way to call methods from a thread.

View 3 Replies View Related

Android :: Service Call Backs To Activity?

Jan 8, 2010

I have a back ground service running.I have a client which interacts with service.

When the client requests for some operation, the service performs it and it should send the result back to the activity(client).

I know how to invoke the service methods in activity and using call backs we can achive wat I wan to do. But I am not able to understa the call back mechanism and code example provided in Api demos(remoteservice).

View 2 Replies View Related

Android : How Can I Call An Activity Through Service In Droid?

Mar 30, 2010

I want to know if it is possible to call an activity through background service in android like..

View 2 Replies View Related

Android :: How To Access Droid Activity Stack From Asynchronous Thread?

Sep 26, 2010

There are a ton of activity stack related questions on StackOverflow, but I didn't really see any that answered the question I have. I'm working on an online game that (for now) has 3 different activities Login/Register Menu (seen when logged in, includes "new game", "my stats", and a few other things...I'm just worried about the "new game" option for now.

View 1 Replies View Related

Android :: Can't Call Service Function In Activity's OnStart / OnCreate?

Sep 28, 2009

My activity bind a service. I want to call the service's function in activity's onStart/onCreate function, but it doesn't work. The service started sunless but the connection is null. When I just call the service's function in other function (onClick for example),

View 4 Replies View Related

Android :: Starting Second Activity From Main Activity On Button Click

Dec 4, 2009

Need an example of how to create/start a new activity from the main activity. I have a button click event on the main layout. Originally I just used setContentView(R.layout.secondactivity); which brings up the layout but I don't think that is correct since the secondactivity class is not instantiated at this point yet. I have looked for such an example and can not find one.

View 3 Replies View Related

Android :: Starting Map Activity From Normal Activity

Apr 25, 2010

I have a map app which works fine when its stand alone but it causes an unexpected error when I try to add it as part of another app. My current app which extends Activity tries to launch the map activity with the following lines of code Intent m = new Intent(this, HomeSetter.class); startActivity(m); I also have the xml setup correctly <activity android:name=".HomeSetter" android:label="Screen 4"> </activity> <uses-library android:name="com.google.android.maps" /> </application> However when I try to launch it crashes everytime. I've tried searching the net but I've had no joy in finding a solution You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe @googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

Android :: Starting Activity Behind Current Activity

Oct 2, 2009

startActivity() displays the new Activity on top of the current one. But how to display it underneath instead? BTW, I'm starting an Activity from another application, if that makes a difference.

View 5 Replies View Related

Android :: Starting New Activity From Activity

Jun 9, 2010

When I was originally learning about Android a few months ago I swear I read something about a way to immediately launch an activity when starting a task. I am curious about this now because I need to display an intro screen on launch but I don't want the intro screen to be the root activity. Does anyone know if there is something like this and if not what is the best way to handle an intro screen?I tried googling for a few hours to find it but can't for the life of me.

View 1 Replies View Related

Android :: Starting Service In Separate Thread

Jul 27, 2009

i have a little frontend showing a list of items that it will retrieve from a service. I want that service to be started in a separate thread.so the UI is still responding to user interaction while waiting for that service to call a callback method. What is the best way to start the service in a detached thread?

View 6 Replies View Related

Android :: AlarmManager Starting Service - API Level

Nov 10, 2010

I've read comment that the AlarmManager in a earlier API version couldn't start services. Prior to which API Level was that?

I'am currently testing in the emulator with API Level 4 and it start a service just fine.

View 10 Replies View Related

Android :: Starting Class1 From Service Without Application?

Jul 2, 2010

I have a call blocking application. It has 3 files:
1) class BlockMyCall extends BroadcastReceiver
2) class SimpleClass1 extends Service
3) PhoneBlock extends Activity

I start "PhoneBlock " Activity to call Service "SimpleClass1 ", which eventually calls "BlockMyCall" intended to block outbound calls (by setting result to "null").

I want to know if I can run the class1 from service without starting activity. If so , how?

View 2 Replies View Related

Android :: Starting Service From Other Apk - Throws NoClassDefFoundError Exception

Jul 31, 2010

I have two projects in Eclipse: service and UI client.

In onCreate in UI client I have:startService(new Intent(this, ExampleService.class));

But this fragment: ExampleService.class throws NoClassDefFoundError exception at runtime. I have installed ExampleService.apk, and ExampleUiClient.apk. Project compiles, and everything looks fine. What I am doing wrong?

Is it possible to start service from other apk?

View 2 Replies View Related

Android :: Starting Activity With FLAG ACTIVITY MULTIPLE TASK To See Multiple Instances

Feb 2, 2009

I am trying to launch an activity from another activity .. Within the com.android.SingleLauncher..

I have activity launch code as ..

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

I have set the android:multiprocess="true" in the AndroidManifest.xml of TargetSL I don't seem to see the multiple instances of TargetSL, which i am expecting ..

All i see is 2 process, where i was hoping to see an instance of TargetSL, for each launch that was invoked by the singleLauncher!

View 3 Replies View Related

Android :: Stopping And Starting Service Based On Application State

Oct 28, 2010

I have a Service which tracks the location of the user. Currently, the Service boots when the application starts and stops when the application terminates. Unfortunately, if users keep the application in the background, the Service never stops and drains battery.

I would like the Service to stop when my application is not in the foreground. I was hoping the Application class would let me Override onPause and onResume handlers, but it does not have them.

View 1 Replies View Related

Android :: Starting Activity With Tabs

May 7, 2010

I have four activity in a Tab and after the user clicked on the list I would like to start another one activity, but I can't use startActivity(Intent), because then I lost the TabHost view, and I get an activity witch is reserving the full screen:( So the user won't be able to click on the other tabs. What should I use? BroadCastReciver or What? If anyone have any good idea please help on me.

View 4 Replies View Related

Android :: Starting Activity By Package Name

Mar 25, 2010

I have the code to get the list of packages installed in phone. I have represented the list in the form of Array List, below is the code snippet. But upon clicking in the package name I want to start that application, but how do I get the respective class name and package name to run? Is there any other method which I can try to start an application? arrayList<String> PackageNames = null; List<PackageInfo> lis = pm.getInstalled Packages(GET_MINIMAL); Pkgs = (ListView) findViewById(R.id.package_list); for (Package Info pi : lis)packages.put(pi.packageName, pi); PackageNames = new ArrayList<String> packages.keySet()); Collections.sort(PackageNames); PackageNames.add(0, "All"); pgs.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple _list_ item_1, PackageNames)); Pkgs.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View v, int pos,long rowId) { Intent i = new Intent(); i.setComponent(new ComponentName(class name,packagename)); startActivity(i); I have tried intent to start the activity, but don't know the class name and package name to pass in the ComponentName() to start activity.

View 2 Replies View Related

Android :: Error When Starting Activity

Mar 22, 2010

I'm starting an activity when a button is pressed, and normally (in other apps) haven't had an issue. But when I press the button in this app, I get an "unable to marshal value" error.Exact(ish) error from LogCat:
03-22 02:49:02.883:
WARN/System.err(252):
java.lang.RuntimeException: Parcel:
unable to marshal value
{CLASSNAME}@44dcf1b8
I feel that this might be related to the extra that I'm passing to the intent. I'm passing an ArrayList as a serializable to this new intent. My concern is that the data structure that the ArrayList contains isn't being serialized (as it's a personal data structure).Is the array list content data structure causing this? Something else that I'm missing?

View 1 Replies View Related

Android :: Starting An Activity For Different Third Party App

Aug 19, 2010

I'm working on an app and I want to integrate the Last.fm app into it. Basically, when someone is looking at an artist in my app, I would like to have a button that they can tap to open up Last.fm application with the artist's information.

This intent works, but it loads a menu asking which app I would like to use (Browser or Last.fm):

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

However, I just want to start the Last.fm app and skip the dialog asking which app to use, I thought maybe using the setPackage() method would work like this: i.setPackage("fm.last.android");


But it causes the app to crash:

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

Is it possible to just start the Last.fm app?

Here's a copy of Last.fm's AndroidManifest.xml for reference.

View 1 Replies View Related

Android :: Error When Starting A Tab Activity?

May 16, 2010

I followed the directions verbatim in this Android tutorial, copying/pasting the code from the site to my app. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

However, when I try to run in the Android emulator, I get the error: "The application Hello Tab Widget has stopped unexpectedly. Please try again."

I tried debugging by introducing a breakpoint in the first line of the onCreate method, but the error occurs before the breakpoint is even hit. Any idea of what is going wrong, or any other way I can debug this issue? I am using Eclipse.

View 2 Replies View Related

Android :: Tabs - Starting A New Activity

Dec 31, 2009

I have 4 Tabs in a TabHost...let them be A,B,C,D.... now each one is just an index page and clicking on any of them shows a different activity...

The problem is that i need to start another activity wen user selects something from the content displayed in the tab... The other activity should also be displayed in the parent tab itself... is it by any chance possible or i'll have to try some other way around?

View 2 Replies View Related







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