Android :: Finish Parent Activity From Child?

Mar 30, 2010

My child activity X is called from Parent activity P through startActivity(intent). I want to close P when X called its finish() method. I override a method finishFromChild(Activity child) in P and called finish() in it. But this functions (finishFromChild(Activity child)) is not being called after X finish() Is it a known bug or I am missing some thing? I googled and also searched the groups but no help.

An alternative could be... using StartActivityForResult() and a "fake" onActivityResult, where I can finish the parent activity, but this way is quite bad, i think...

I prefer the first one, if it would work....

Android :: finish parent activity from child?


Android :: How To End Child Activity And Return To Parent Activity?

Jul 25, 2010

I have a main screen with buttons to launch other subactivities. I have to press back button each time to go back to the main screen of my application. How do I finish a child activity and automatically return from the caller?

View 5 Replies View Related

Android :: Parent And Child Activity OnCreate?

Jul 2, 2010

I have a parent activity, and a child activity that extends the parent activity. When the parent starts the child activity,

Which onCreate gets executed first? The child's or parent's?

There is a particular variable I am setting in the Child activity's onCreate method, and right now, it looks like it takes a while to get to the Child activity's onCreate, and so the methods in the Parent are reporting an empty variable. Whereas when I make the Parent sleep for a while, it reports the correct variable.

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

So, basically, even after the Parent starts the Child, it still returns "Parent Value", but when I have the thread sleep, it return "Child Value".

View 1 Replies View Related

Android :: Finish Child Activity From Another In Droid?

Sep 14, 2010

I have a parent activity (as ACTIVITY GROUP) and some child activity of this parent activity (as ACTIVITY).
I am just calling child1 now i want to move from child1 to child2 and just want to finish() child1.
But when i am calling finish() it is also finishing the parent activity.

View 1 Replies View Related

Android :: Want To Open New Child Activity In Parent LinearLayout

Nov 8, 2010

I want to open new child activity in the parent LinearLayout. Just similar like Tabs.

View 1 Replies View Related

Android :: FinishFromChild And OnActivityResult Not Firing When Child Starts Activity Of Same Type As Parent

Jun 8, 2010

I have an application, which (for the sake of simplicity) has two types of activities - Overview and DetailView. The Overview activity shows a list of steps and allows the user to start a DetailView activity corresponding to the step chosen.

In the DetailView activity, the user can start another Overview, which shows different steps than the ones in the parent of the current DetailView.

In the Overview, DetailView is started by using startActivityForResult (). In the DetailView, when the user decides to start a second Overview, I call setResult () and finish () and then start the new Overview. In this scenario, onActivityResult () and finishFromChild () do not fire. Instead, they fire when the parent finishes (?).

Code from Overview:

CODE:....

Code from DetailView:

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

View 1 Replies View Related

Android :: Child Activity Does Not "finish()" Correctly

Jul 8, 2010

I have a ListActivity I display from a parent activity. When the user selects the desired item from the list it supposed to return to the parent activity. Only when I call finish, the app goes away (doesn't quit) and displays the Android Home page. If I debug, the application doesn't die, it just sits on an MessageQueue.Wait().

I have a break point right before the finish() call and one in the first line of the OnActivityResult. When I press continue from the first, I never see the second on in onActivityResult.

I have other child activities in my app that don't display this problem. However this is the only ListActivity I have that I am trying to return from. I do call finish from onListItemClick. I'm wondering if that is not allowed since that is responding to a view event. However if I don't do it here, how can I get back to the parent activity. Below is the code snippet of my finish method.

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

View 3 Replies View Related

Android :: Possible For The Child Of An ExpandableListView Also Be A Parent?

Nov 5, 2010

Is it possible for the child of an ExpandableListView also be a parent?

For example, I need something like the following: ParentA ChildA ChildB ParentB ChildC GrandchildA? GrandchildB? ParentC

View 4 Replies View Related

Android :: Scrollable Parent With ListView Child

Dec 14, 2009

I know it's considered taboo to place a ListView inside a scrolling container, so is there any "proper" way to accomplish scrolling of a container that has a ListView child in it? An example layout would look something like:

Header
---
"Sub" header
---
ListView with list items
---
Footer

Header and Footer need to remain static on the screen, and the middle content (Subheader and ListView) should scroll between them. I can't have just the ListView scrollable, because the subheader takes up too much space. As it is currently, the Header comes from an <include />, the Subheader contains several views including an Image and some text, and the ListView (actually part of a ViewFlipper) would contain an indeterminate number of items. The Footer has a couple buttons/tabs that are used to control the ViewFlipper (only one of the views in the flipper is a ListView).

The only way I can think of to accomplish this efficiently would be to place the Subheader inside the ListView as the first item -- is there any better way?

View 1 Replies View Related

Android :: Activity Finish Method Waits To Finish?

Aug 14, 2010

With this sample code, the activity is told to finish, but continues execution afterwards and displays the message. I'm trying to understand why this happens. The only fix I can think of is to place 'return' after finish.

public void someMethod() {
if( valueIsTrue) {
startActivity(new Intent(this, NewActivity.class));
CurrentActitivy.this.finish();

// return; // if uncommented, Toast doesn't show
}
Toast.maketext(this, "Some message", Toast.LENGTH_SHORT).show();}

View 1 Replies View Related

Android :: Add Image In Expandable List In Parent / Customize Child In It?

Aug 30, 2009

How to add image in expandable List in parent in android ?

If possible how to customize the child in expandable list?

View 3 Replies View Related

Android :: Remove Parent Icon In Expandable List / Where To Customize Child?

Sep 5, 2009

1) I have made an customizable expandable List .

2) Where I can customize the child.

3) But in parent(Group ID) I want to change the default icon of the parent.which look like(>).

View 1 Replies View Related

Android :: Inherit Parent Style And Set Background For Non- Focused Enabled Child Item?

Dec 14, 2009

I'm using ExpandableListView in my app and one of the complains is that when expanded it's hard to visually distinguish where the child item ends and next group item begins. So I would like to change background of the child list item to the different shade. Brutal attempts that I've made so far were based on directly changing background color and text of the elements inside the child view item but that leads to loss of hovers and highlights. So my question is - what is a good strategy to achieve the above? I tried styles and selectors but what really bums me out - that if I change one thing then I need to add selectors for all combinations of focus/enabled etc. when all I'm trying to do it to overwrite a single thing. Is there a way to inherit parent style and set just a background for non- focused, enabled child item?

View 2 Replies View Related

Android :: Adding Child View At Particular Location In Parent View

Mar 20, 2010

I need to draw a child view containing a rectangle and button on top of the content view at particular location on the parent (content view). How can I do this? Did not find an explicit way to set origin of child view?

View 1 Replies View Related

Android :: Finish Any Previous Activity In Stack From Current Activity?

Apr 27, 2010

How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity?

View 1 Replies View Related

Android :: Activity Parent - Created Activity Returns A Nul ?

Apr 7, 2010

Can someone tell if why when starting an activity with startActivity(intent) , calling getParent() in onCreate() of the new created activity returns a nul ?

Also how could I obtain the parent of an activity created in such a way ? Can a reference of the activity below the current activity in the activity stack be obtained ?

View 2 Replies View Related

Android :: Finish Activity Not Started From Current Activity

May 1, 2010

I have following problem with my application: From my main activity ("activity 1"), there is a menu from which user can launch an action. This action will result in an Intent being received by a BroadcastReceiver, defined in my application. Finally, this BroadcastReceiver will start an activity ("activity 2") to deal with this intent.

The problem is that I have a "quit application" entry in my menu, and I can only finish() currently active activity. ie I am not able to finish "activity 1" from the menu of "activity 2". And I can't use startActivityForResult() as "activity 2" can't be started from "activity 1". Any suggestion would be much appreciated Thank you very much guys, regards.

View 4 Replies View Related

Android :: Finish Activity From Other Activity

Oct 8, 2010

I am having application in which i am using menu , on tap on menu item i am redirecting to specified activity. I want to make sure that when i am redirected to another menu item my current all activity should be finished to reduce the stackflow of the activity and better performance. So when i tap on back from my tapped activity from the selected menu activity i should be redirected to another activity and finish current activity. So i am wondering is there any way by which i can finish another activity from my current activity. Or should i override the OnKeyDown Method..

View 1 Replies View Related

Android :: BringtoFront The Parent Activity?

Sep 7, 2010

As we know, startActivityForResult() used to get a result for a task from parent activity. Here when we click the setResult(). It returns the result to the parent Activity.

Child Activity means it should maintain the persistent state. That is when the users clicks a button on the child activity. It do not finishes that activity and show the Parent Activity. And again i may go to the child activity from parent activity. If the child does not exists it starts a new child activity else it should show the existing child activity with persistent content.

Simply said, my parent Activity starts a new Child Activity. Now both Activities should be alive. How to call the Parent Activity without finishing the child Activity(in other words, How to BringtoFront the parent Activity)? For this scenario,

you can not use startActivity(). Because it creates a new Activity Instance. Not Existing Parent Activity
you can not use startActivityForResult(). Because it finishes the child Activity Instance.

View 2 Replies View Related

Android :: How Finish An Activity In This Instance

Aug 16, 2010

We all know that hitting the back button on the device doesn't kill the application, it merely finishes (destroys) the activity running on the foreground.

Well I have come across some code which helps me capture the back button signal so that I cannot exit the application. The only way to exit it in such cases is to press the home key.

Now this situation presents me with a unique disadvantage! The inability to kill finish the application on a time of my own choosing allows the application to keep running in the background like nothing has changed.

So in such cases is the task manager my only friend or is there a way for me to otherwise kill this application?

View 2 Replies View Related

Android :: Activity Pause Rather Than Finish?

Nov 30, 2009

I see no means by which my activity can pop itself off the activity stack to return the user to the one he was using before it was invoked. Is there one? My purpose is that my app has some data structures built from data provider queries that take 5-15 seconds to assemble and I don't want a lot of latency if it is used in a few one-shot purposes in rapid succession. I'm more than willing to let the system ask my app to die, but I'd like to keep warmed and ready otherwise.

View 4 Replies View Related

Android :: Wait For Activity To Finish?

Sep 7, 2010

I have one activity call a camera view activity, and in the onActivityResult, I have it start that activity again with different parameters. Android doesn't seem to like that, and gives me an error that the camera is not available if I start it right after it returns. I tried just waiting a few seconds, but this doesn't seem to work on all phones, and it sometimes crashes. Is there some way to wait until that activity finishes properly, and gives up all resources?

View 6 Replies View Related

Android :: Finish Not Killing Activity

Apr 12, 2009

I've got an application that has (among other things) three Activities, let's call them A, B, and C. A is the main navigation point for the entire application, and launches B and C directly using startActivity(). They work fine that way. However, when I call C from inside B, I get a strange problem. The code for launching Activity C is exactly the same in both places. The problem is the hardware back button. In the emulator, it takes two presses of the back button in order to close Activity C and come back to B. On a G1, it takes 3 or 4 presses. Upon seeing this, I implemented the usual suspects in C - onPause(), onStop(), and onDestroy(), and onResume() in B. When I press the back button from C and it doesn't work, I get onPause(), onStop(), onDestroy () - in that order, but nothing happens. When it works (on press 3 or 4 on the G1), I get onPause(), then onResume() in B, then onStop() and onDestroy().

I've tried catching the key press of the back button and calling finish (), but that doesn't make a difference. Has anyone seen this? To pre-empt some questions: All C does is display some data. There are no threads or any other special resources that C might have an active handle to that's preventing it from closing. But out of curiosity, if it did, how would I detect that? Any ideas for further diagnostics here?

View 12 Replies View Related

Android :: Finish() Won't Close Activity

Jul 23, 2009

I have an EditText field and I want to pop up a new window/activity whenever a user touches/clicks the field. The new window has some widgets and of course Apply and Cancel buttons. Here is the code how I intercept the onTouch event.

EditText ctlMaskEt = (EditText)findViewById(R.id.mask_field); ctlMaskEt.setOnTouchListener(new OnTouchListener() { public boolean onTouch (View v, MotionEvent event) { popMaskEditor(); return true; } });

Everythings work fine until I click the Apply and Cancel buttons. The API finish() won't close the new window unless I click the same button one more time. Calling popMaskEditor() from a button's OnClick event handler doesn't have this problem.

View 2 Replies View Related

Android :: Activity That Does Not Fill The Parent Screen

Dec 14, 2009

Any idea why this doesn't create an activity that looks like a popup instead of an activity that completely fills the screen?

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

I assumed that I only needed to set the layout height and layout width to something other than "fill_parent", but it still shows up as a black screen that completely fills the screen.

Ultimately, I simply want to create a popup, but I do not want to use an AlertDialog. Is this possible?

View 2 Replies View Related

Android : Use Data Passed From Parent Activity In A Sub?

Jun 28, 2010

When we want to pass data from an activity to a sub activity we use the is there any event handler that handles this?

View 1 Replies View Related

Android :: Finish Activity Doesn't Work

Nov 5, 2009

In main Activity, I called start Activity For Result(intentB, 100) to start a new activity B, then in B, I called startActivity(intentC) to start another activity C. Lastly I wanted to call finish Activity(100) in C to close activity B, but seemed it was not successfully destroyed(I can use BACK key to see it's still there.)

View 6 Replies View Related

Android :: Finish Activity When Home Pressed?

Mar 25, 2010

I saw another thread related to this question, but did not find the answer that was useful to me. Is it possible when the user presses the Home button to be able to finish() my activity somewhere? I saw that people were having problems with using onStop(). Has anyone found a resolution to see if this is always called on Home being pressed?

View 5 Replies View Related

Android :: Does Pressing Back Always Cause Activity To Finish()?

May 10, 2010

I've heard that pressing the back button will essentially cause the current Activity to finish(). Is this always the case? Seems like it would be with the way it pops the Activity off the stack.

The one situation I'm not so sure about is when the root Activity in a Task has back pressed. I'm currently experiencing a very weird effect, described as follows:

On loading my application, the first Activity is for initialization, and once it finishes, it calls my main Activity (a TabActivity). This first init activity has android:noHistory="true" set in the Manifest so pressing Back from my main Activity won't go back to that. It goes to the Launcher. When I click on my App in the Launcher a second time, the initialization activity loads again, and loads the main Activity when done. Almost immediately after, it loads a second instance of my main Activity. But ONLY after the Application has already been run once, and was exited by pressing BACK from the main Activity. It does it every subsequent time until I force quit the app or load a new version from the IDE.

Based on this, I am suspecting some kind of Activity instance is lying around and being reused, since it only happens on the second+ time I run the application (and exit with BACK -- using HOME just returns to the last state of the app, no big deal).

View 4 Replies View Related

Android :: Finish Activity From Custom BaseAdapter

Nov 22, 2010

In my android application I have custom listview with an image and textview. In extended BaseAdapter under getView method click events of textview and image are associated with onClick method using setOnClickListener as shown in code below

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

And

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

When clicking on image it acutally deletes that entry from List which works fine, but on clicking textview i would like to return the text of clicked textview to main activity but I am unable to achieve this, although I can do this from setOnItemClickListener of this custom listview acitivity.

View 1 Replies View Related







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