Android :: Way To Call Other Activities In An Activity?
May 8, 2010
Say I have 2 activities (ActivityOne and ActivityTwo). How would I call ActivityTwo from ActivityOne? Then how would I return to ActivityOne from ActivityTwo? For example, I have a listview with all the contacts on the host phone. When I tap on a contact, another activity shows information and allows editing of that contact. Then I could hit the back button, and I would go back to the exact state that ActivityOne was in before I called ActivityTwo. I was thinking an Intent object, but I am not sure. Could someone post some code?
View 2 Replies
Nov 2, 2010
Today i met with the serious problem. Actually i have 5 activities in my activity group.
From 1st activity i go to 2nd and from 2nd i go to 3rd and so on....and on the 5th screen when i press back key i came to 4th and so on....
When i again go to the same process it displays me the previous displayed data as well on the screen. m not able to find the sollution for the same.
I need that every time i follow the process it will show me the new data not with the previous one data.
I cant paste the whole code. its 5 activities.
View 1 Replies
View Related
May 30, 2009
Is it possible with one call to finish all previous Activities. (like: this.finish(all) :)
I have a main activity, calling a preferences and there is a switchuser point that switch the user and call the main activity again. But than i don't need that the user can go back, step by step, It would be just fine i could say "kill all previous activities" in the moment the user click "switch user".
View 7 Replies
View Related
Dec 29, 2009
I currently have widget for my app Hire*A*Droid bundled with the main application. I would like to unbundle the widget and release it as a separate offering. However - the widget is relying on Activities from the main app so I need to navigate between these two mainly calling particular Activity of the main app from the widget. So the basic idea - app can work without widget and the widget becomes the "add-on" option.
What is the "right" way to call app activities from the stand-alone widget? Do I convert the main app into a content provider? Can you point me to any code samples perhaps?
P.S. I'm not asking how to call Activities from the widget that is bundled in the same APK. The question specifically states that widget is distributed separately from the app it's calling
View 1 Replies
View Related
Aug 23, 2010
I need to keep track of currently existed Activities in Activity stack.
Can any one help me in that how to do it programmatically?
View 1 Replies
View Related
Jun 12, 2010
I want to know if we can display multiple activities in a single activity using ActivityGroup.Can anyone please help me out with this?
View 1 Replies
View Related
Nov 10, 2009
Can Activity "A" open the options menu of a view in Activity "B"? In this case I am building Activity A but Activity B can be any other running activity. I think this is an impossible security violation but I really want someone to prove me wrong.
View 2 Replies
View Related
Oct 13, 2010
I want to display the same options menu on all of my application's activities. I created a generic Activity that implements the menu, and all my further activies extend it. The problem: when I need to extend other specific activities, like ListActivity and MapActivity, I can't figure out how to extend the generic activity and add the List or Map behaviour to the new class. To deal with the issue I had to create three different generic activities, each extending Activity, ListActivity and MapActivity.I've tried creating an abstract activity but it doesn't work, I would need to extend two classes at the same time. I could try interfaces but since I can't implement methods, I would have to paste the menu implementation all over the second-level classes, right?
View 1 Replies
View Related
Aug 4, 2010
I have activity A that starts activity B which starts activity C
A -> B -> C
When a user clicks on a button in activity C, i want to bring A to the top of the stack and take B & C completely out of the stack. Is there a way to do this ? ?
View 2 Replies
View Related
Apr 8, 2010
I am trying to make an exit button for my application. Anyhow I am able to track all the instance of activity in my application and then finish them all. But still some activity remain alive in some cases. Dont know how. Is there any method to kill a particular application in android. Or any other way can I exit from my application.
View 1 Replies
View Related
Apr 20, 2010
I have an application consisting of two activities (call them Display and Preferences) and one service which listens for incoming phonecalls. When it detects one it launches the Display-activity with a delay of 3sec in order to let the PhoneApp launch first. The Display- activity is transparent so the user can still use the PhoneApp as normal (ie answering the call) even though my Display-activity is "on top". So far so good
Now to my problem. Lets say that the Preferences-activity is active when there is an incoming call. The PhoneApp is launched on top of the Preferences-activity as expected. However when the Display-activity is launched the Preferences-activity pops up as well, hiding the PhoneApp. My question is if it is possible to work around this in some way? Since I do not want my Preferences-activity to block the PhoneApp and hence making it impossible for the user to answer the incoming phone call.
View 3 Replies
View Related
Feb 24, 2010
I am currently showing a notification. When the user clicks this noticiation, the application is started. The notification persists, to indicate that the service is running in the background.
CODE:..............
However, I have detected a case where a bug appears. If the user starts the application through clicking the normal icon, and while the activity is running clicks the notification, then a new activity is started without the earlier one exiting, the later being on top of the earlier. And that is not all: Further clicks on the notification will create additional activities and place them on top of those already running. How can I prevent this? Is there a nice check to do to see if a certain activity is currently being shown or is loaded?
View 1 Replies
View Related
Jun 26, 2010
I'm currently debugging my app which is quite complex and has up to 5 activity levels. In order to detect memory leaks (i.e. activities that aren't removed from memory even finish() is called, due to some references held somewhere) I want to check which activities are still alive in memory. Currently I create hprof dumps, but it's not very convenient, cause every time I need to mount the sdcard, copy the hprof dump file from the sdcard to my PC, etc. (Side note: I already tried to automate the pulling of my hprof file more easily, but I'm on an unrooted device and adb pull <hprof file> won't let me / no permission.) Therefore I am wondering, if all I want to know is IF and WHICH activities are still currently alive in my memory, is there a way through the Android API or any other way on-the-fly with which I can achieve this (list all alive activities of my app), programatically.
View 2 Replies
View Related
Apr 15, 2010
Experts: My MainActivity launches a SubActivity by calling: startActivityForResult(intent, REQ_CODE); The SubActivity shows a dialog that has two buttons: Yes, No For the dialog, I've the following code: public void onClick(DialogInterface dialog, int whichButton) {/* User clicked OK */setResult(DialogInterface. BUTTON_POSITIVE) ;finish();
View 2 Replies
View Related
Jul 15, 2010
When i leave my app after pressing home button and then re launch it from menus it behaves in a strange way.Sometimes it launches the same activity on which i pressed home button.But sometimes it launches the first activity of my app. One reason for this could be that whenever system has memory shortage it clears any activities existing in But the strange thing is if i press back button from first activity it takes me back to the same activity on which i pressed home button and all other previous activities are also there(like if i press back button again previous activities also exist.)I haven't set any launching mode for any activity in my app(like single instance etc).What i don't need is that previous activities load on pressing back button on first activity.
View 2 Replies
View Related
Mar 12, 2010
How can i call one activity to other activity without using intents and services?
View 3 Replies
View Related
Feb 17, 2012
So I have my main activity. It starts out adding a custom SurfaceView called DrawView as the content view with
DrawView drawview = new DrawView(parameters);
this.setContentView(drawview);
now my layout.main.xml is a layout with a video view which I am using to play my cutscenes. I am able to switch to this view by calling a method I made which switches the content view by
this.setContentView(R.layout.main);
which works fine when I am calling this method within the Activity. Only problem is I need to call this method from within DrawView! The method I made to switch to my cutscene is public and I do pass the Activity (named Draw) as a parameter of DrawView.
So when I do call this method from within DrawView my game freezes and will subsequently crash! however it works when method is called locally?
View 3 Replies
View Related
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
Jun 30, 2010
how to call BarCodeScanner, and return the value to a field.so now, i have a toast that says "successful scan" and then i want to pass the result to a new activity. when i comment out my intent, everything works (minus the passing of data/switching of screen, obviously) but when i run my project as is, it FC's no errors reported by eclipse in code or xml. any insights?
View 2 Replies
View Related
Jun 7, 2010
A TabActivity start other activity when i click on a tab,
How to send information to parent (tabActivity) and don't finish current activity?
My tabactivity start another activity like this :
CODE:............
Inside my new Activity Option, i would like to Call method of Tabactivity, is it possible ?
View 1 Replies
View Related
Jun 25, 2009
How can I call an activity of app A from app B.
View 6 Replies
View Related
Jun 23, 2009
I am developing a android application with more than four activities. i am starting a activity using startActrivity() method wherever i need to go for other activity. i feel this degrade my application performance.
View 2 Replies
View Related
Jul 26, 2010
When I try the above, I get a class not found exception. I have included the required entry in manifest file. The code in current activity is as follows: Intent i = new Intent(MainListingA.this, DrawTheatreMap.class); try{startActivity(i); The error I get is as follows: 07-26 23:03:20.259: WARN/dalvikvm(307): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): FATAL EXCEPTION: main 07-26 23:03:20.397: ERROR/AndroidRuntime(307): java.lang.NoClassDefFoundError: com.mobilo.movie.DrawTheatreMap 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at com.mobilo.movie.MainListingA$1.onItemClick(MainListingA.java:101) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.widget.ListView.performItemClick(ListView.java:3382) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.os.Handler.handleCallback(Handler.java:587) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.os.Handler.dispatchMessage(Handler.java:92) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.os.Looper.loop(Looper.java:123) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at android.app.ActivityThread.main(ActivityThread.java:4627) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at java.lang.reflect.Method.invokeNative(Native Method) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at java.lang.reflect.Method.invoke(Method.java:521) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:868) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 07-26 23:03:20.397: ERROR/AndroidRuntime(307): at dalvik.system.NativeStart.main(Native Method) On a standalone basis, the same map activity works fine.
View 14 Replies
View Related
Jul 26, 2010
I get a class not found exception. I have included the required entry in manifest file.The code...
View 2 Replies
View Related
Nov 24, 2010
I am launching an activity to make a phone call, but when I pressed the 'End Call' button, it does not go back to my activity. Can you please tell me how can I launch a call activity which comes back to me when 'End Call' button is pressed?
View 5 Replies
View Related
Apr 21, 2009
I have a java class Poker.java and an Activity .GameWindow in GameWindow.Java. In the GameWindow activity i have a method...
View 2 Replies
View Related
May 30, 2009
I've read through the Application Fundamentals three times today (and I had done so before), but I still can't quite wrap my ahead around the task concept. Or I guess I thought I understood it, but usually, the results I am seeing don't match up to what I would expect to happen (maybe a tool to see the current tasks/activities etc. for debugging purposes would be a nice addition).
I have multiple widgets from my provider in the Launcher desktop, and each is using a PendingIntent with a different URI as data (so they should be separate intents) to open an Activity.
I want there to be only once concurrent instance of this Activity that the user can access. So clicking the widget (1) , pressing HOME (2), clicking a different widget (3), pressing BACK (4) should bring the user back to the Desktop.
Now I did manage to do this using launchMode="singleTask" - the existing instance is brought to the top, onNewIntent() is called and I am pretty satisfied with it.
However, supposedly there are other ways to achieve an equivalent effect (say with having the activity restarted), and I'd like to understand why I don't seem to be able to get them to work: In every case, instead of seeing the home screen after step (4) (after pressing BACK), I see the *previous* instance of the Activity.
For example, if I read this correctly:
"There's another way to force activities to be removed from the stack. If an Intent object includes the FLAG_ACTIVITY_CLEAR_TOP flag, and the target task already has an instance of the type of activity that should handle the intent in its stack, all activities above that instance are cleared away so that it stands at the top of the stack and can respond to the intent. If the launch mode of the designated activity is "standard", it too will be removed from the stack, and a new instance will be launched to handle the incoming intent." http://developer.android.com/guide/topics/fundamentals.html
Then simply using using the following code to start my Activity from my widget should do what I want, no?
CODE:............
So in (3) My activity should be launched using FLAG_ACTIVITY_NEW_TASK by the launcher, which due to process affinity would find the existing task (which would consist of a single instance of my Activity), and launch the new instance on top of it. This explains what I am seeing. Why doesn't FLAG_ACTIVITY_CLEAR_TOP cause the existing instance in the task to be replaced?
Even setting android:launchMode explicitely to "standard", as mentioned in the doc quote above, this doesn't seem to change things.
I also tried android:finishOnTaskLaunch="true", but the behaviour is the exact same was just described with FLAG_ACTIVITY_CLEAR_TOP (which seems to be the exact same as when doing neither and really starting an activity without any special attributes).
I should mention that If I click the same widget in (3) as I clicked in (1), i.e. using the same PendingIntent twice, I do get the previous instance brought to the front (not restarted), but again, regardless of whether FLAG_ACTIVITY_CLEAR_TOP or finishOnTaskLaunch are being used.
I find this especially strange since the docs about tasks don't seem to mention the intent itself being relevant at all. Application Fundamentals does at one point say "For the default "standard" mode, a new instance is created to respond to every new intent", but it's not clear what "new intent" means then. Is triggering a PendingIntent multiple times through a widget not multiple "new" intents then?
I also tried various combinations of the other related options, but pretty much got nowhere.
View 2 Replies
View Related
May 20, 2010
My application contains 2 activities A and B. B is opened with startActivity(intent) in A, when B is closed with finish(), I found the method finalize() of B is not called.
My question is: How to force Activity to call finalize() when it is closed with finish()?
View 5 Replies
View Related
Aug 16, 2010
I wrote successfully TTS with some references in Activity.
However, I want to call this TTS in my own class as below.
CODE:............
View 3 Replies
View Related
Sep 27, 2009
1. i have a service that will launch an activity. How to make the activity launched like a phone call? i mean when the phone screen is locked, it will awaken.
2. how to start a service right after downloaded and installed from android market?
View 8 Replies
View Related