StartActivityForResult

by Business Talk » Wed, 06 Jan 2010 22:50:40 GMT


Sponsored Links
 I am using ListActivities to drill down into a hierarchy; artist,
album and song. One activity per hierarchy. So, from the main
activity  I start the ArtistActivity with the StartActivityForResult
method and when the an artist is selected I call the

protected void onListItemClick(ListView l, View v, int position, long
id) {

setResult(Activity.RESULT_OK, results);
finish();

}

to return the results. Than the main activity receives results from
the ArtistsActivity in the onActivityResult method and starts the next
hierarchy activity, AlbumActivity, in the same way as the previous
activity, on so on. It works fine except that when calling finish
method the hierarchy activity is removed from the stack. So, it makes
it impossible to backtrack to the previous hierarchy since it not
there anymore. For example, I can backtrack from AlbumActivity to
the ArtistsActivity since it has been removed from the stack.  My
question is; is there any way to leave the hierarchy activities on the
stack?



StartActivityForResult

by Mark Murphy » Wed, 06 Jan 2010 23:05:28 GMT


 > I am using ListActivities to drill down into a hierarchy; artist,

Instead of calling setResult()/finish() in a list item click,
startActivityForResult() the next level down in the hierarchy. Only the
leaf should call setResult()/finish() in a list item click. All branches
of the hierarchy should call setResult()/finish() in their
onActivityResult(), forwarding the leaf's result Intent along.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Android App Developer Books:  http://commonsware.com/books.html 


Sponsored Links


StartActivityForResult

by Business Talk » Wed, 06 Jan 2010 23:38:03 GMT


 Thanks Mark, it will work. I was considering this approach. I was
hesitant for it establishes a dependency among the hierarchy
activities. I thought I might have a need to reuse the activities in
other scenarios in which I might have to select the artists/albums/
songs only without drilling down the hierarchy. I will go with your
suggestion thought.

Roman





> - Show quoted text -



startActivityForResult

by Pierre Henry » Sun, 28 Feb 2010 05:41:11 GMT


 Encoutered a tricky result using startActivityForResult from an
Activity

In the called Activity , I set result like that:
______________
setResult(RESULT_OK, getIntent().putExtra(getPackageName()+"values",
values));
______________________

When running the on ActivityResult, the extra has disappeared from
intent in the method *onActivityResult*

In the api doc, it is telling that package name must be used , so I
used it (see code upwards ).

So why is that ?

--



startActivityForResult

by Mark Murphy » Sun, 28 Feb 2010 07:08:25 GMT


 


Create a fresh Intent (via new Intent()) and see if that helps.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

--



startActivityForResult

by jarnaud » Mon, 01 Mar 2010 08:02:57 GMT


 Hi Pierre, I have release a set of video android tutorials on
 http://android.voxisland.com 
and the free/sample chapter is on Intents. It should answers your
questions and provide you
some guidance to go further with Intents.
enjoy




--



startActivityForResult

by kypriakos » Thu, 19 May 2011 11:44:45 GMT


 Hi all,

I am writing apps for some old phones (Android 1.6). I can call
startActivity(intent) without issues but the
startActivityForResult(intent, int) fails on compile? Was this method
introduced after 1.6? How can one see what's been deprecated across
versions?

Thanks

-- 



Re: startActivityForResult

by Giorgio Vespucci » Thu, 19 May 2011 12:17:05 GMT


 In the upper right corner of API page there is a scrollbox you can use to
filter the minimum API level you want to see.
Hope this helps. :)
 Il giorno 19/mag/2011 05:44, "kypriakos" <demet...@ece.neu.edu> ha scritto:

-- 



Re: startActivityForResult

by Our-Android » Thu, 19 May 2011 12:27:34 GMT


 hi,


find the link below you will get complete code for
startActivityforResult()


 http://our-android.blogspot.com/2011/05/passing-data-returning-data-between.html 



Thanks






-- 



Re: startActivityForResult

by kypriakos » Fri, 20 May 2011 02:00:09 GMT


 Great thanks - much appreciated it. But I was also asking as to
whether the
startActivityforResult() is part of the Android 1.6 API since the
compilation
fails there. Any idea?

On May 19, 12:27am, Our-Android <sachin.worldnet.prog...@gmail.com>




-- 



Re: startActivityForResult

by kypriakos » Fri, 20 May 2011 02:04:41 GMT


 Excellent!  Thanks.

So the API level 4 (to which cupcake/1.6 is based on) does not have
the startActivityForResult -
which is in line with the fact that the compilation fails. Anyway
knows as to what provision
was available back then for allowing an activity to call back a
calling class? Or no such luck?
Will I need to use some kind of shared mem or a file method to pass
results back?

Thanks


On May 19, 12:16am, Giorgio Vespucci <giorgio.vespu...@gmail.com>



-- 



Re: startActivityForResult

by Nicholas Johnson » Fri, 20 May 2011 02:12:10 GMT


 startActivityForResult has been in the API since level 1.

1.6 has it.

Here's a link to the 
documentation< http://developer.android.com/reference/android/app/Activity.html #startActivityForResult(android.content.Intent,
 
int)>.

-- 



Re: Re: startActivityForResult

by Kostya Vasilyev » Fri, 20 May 2011 02:13:00 GMT


 Huh?

 http://developer.android.com/reference/android/app/Activity.html #startActivityForResult(android.content.Intent, 
int)


Since API level 1 - i.e. Android 1.0.

Perhaps you could post a code snippet showing the compile error.

-- Kostya

19.05.2011 22:04, kypriakos :
So the API level 4 (to which cupcake/1.6 is based on) does not have the startActivityForResult - which is in line with the fact that the compilation fails.
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: startActivityForResult

by kypriakos » Fri, 20 May 2011 05:40:36 GMT


 That's what I said too - huh? ;)

        Intent intent = new Intent();
        intent.setClass(androidContext,
mysnapPic2ServiceImpl.class);
        intent.setFlags(intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra("from", "1");
        final int result=1;
        // androidContext.startActivity(intent);
        androidContext.startActivityForResult(intent, result);

The startActivity method (commented out) is found fine when used - the
one below it gives:

[ERROR] snapPic2Servlet.java:[89,22] cannot find symbol
symbol  : method startActivityForResult(android.content.Intent,int)
location: class android.content.Context

It has to be something stupid I can't see right now ...




-- 



Re: Re: startActivityForResult

by Justin Anderson » Fri, 20 May 2011 05:51:18 GMT


 Where are you getting androidContext from?

Thanks,
Justin Anderson
MagouyaWare Developer
 http://sites.google.com/site/magouyaware 






-- 



Other Threads

1. webview crashes

hi all,

I'm getting fairly regular crashes using WebView's in the underlying C
code (sigsegv's). There isn't
a _whole_ lot of rhyme or reason to it, but one thing that is somewhat
suspicious is that I have
more than one webview active (only one is one the screen at any one
time, but if this has anything
to do with my problem it may not matter since it appears that webkit
widgets run asynchronously
from the main UI thread).

Here's the stack dump. I've looked through the archives and it appears
that there are other
dumps, but it's really hard to tell from my vantagepoint whether they
have anything to do with
one another.

This is pretty easily reproducible (especially with one particular url
of mine) so it should be
relatively easy to track down.

Thanks, Mike

I/DEBUG   (   32): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
I/DEBUG   (   32): Build fingerprint:
'tmobile/kila/dream/trout:1.5/CRC1/150275:user/ota-rel-keys,release-keys'
I/DEBUG   (   32): pid: 911, tid: 922  >>> com.phresheez.phresheez <<<
I/DEBUG   (   32): signal 11 (SIGSEGV), fault addr 0000000c
I/DEBUG   (   32):  r0 445d986c  r1 445d9998  r2 445d9998  r3 00534318
I/DEBUG   (   32):  r4 00000000  r5 004548c8  r6 445d9998  r7 0000007f
I/DEBUG   (   32):  r8 445d9da0  r9 41046e18  10 41046e04  fp 00000001
I/DEBUG   (   32):  ip aa3dbb38  sp 445d97f0  lr aa181c7b  pc aa0bdd48
 cpsr 20000030
W/InputManagerService(   59): Window already focused, ignoring focus
gain of: com.android.internal.view.iinputmethodclient$stub$pr...@432ca120
I/DEBUG   (   32):          #00  pc 000bdd48  /system/lib/libwebcore.so
I/DEBUG   (   32):          #01  pc 00181c78  /system/lib/libwebcore.so
I/DEBUG   (   32):          #02  pc 00182c56  /system/lib/libwebcore.so
I/DEBUG   (   32):          #03  pc 0018e66e  /system/lib/libwebcore.so
I/DEBUG   (   32):          #04  pc 0018ba62  /system/lib/libwebcore.so
I/DEBUG   (   32):          #05  pc 0018c0d0  /system/lib/libwebcore.so
I/DEBUG   (   32):          #06  pc 0018c7ae  /system/lib/libwebcore.so
I/DEBUG   (   32):          #07  pc 0017de08  /system/lib/libwebcore.so
I/DEBUG   (   32):          #08  pc 00180402  /system/lib/libwebcore.so
I/DEBUG   (   32):          #09  pc 001853ce  /system/lib/libwebcore.so
I/DEBUG   (   32):          #10  pc 0018540c  /system/lib/libwebcore.so
I/DEBUG   (   32):          #11  pc 00186146  /system/lib/libwebcore.so
I/DEBUG   (   32):          #12  pc 00186408  /system/lib/libwebcore.so
I/DEBUG   (   32):          #13  pc 001867d6  /system/lib/libwebcore.so
I/DEBUG   (   32):          #14  pc 00186832  /system/lib/libwebcore.so
I/DEBUG   (   32):          #15  pc 00186874  /system/lib/libwebcore.so
I/DEBUG   (   32):          #16  pc 00259d04  /system/lib/libwebcore.so
I/DEBUG   (   32):          #17  pc 0000e3b4  /system/lib/libdvm.so
I/DEBUG   (   32):          #18  pc 00040a8a  /system/lib/libdvm.so
I/DEBUG   (   32):          #19  pc 00013118  /system/lib/libdvm.so
I/DEBUG   (   32):          #20  pc 00017b1c  /system/lib/libdvm.so
I/DEBUG   (   32):          #21  pc 00017560  /system/lib/libdvm.so
I/DEBUG   (   32):          #22  pc 000520ec  /system/lib/libdvm.so
I/DEBUG   (   32):          #23  pc 0005210a  /system/lib/libdvm.so
I/DEBUG   (   32):          #24  pc 00047144  /system/lib/libdvm.so
I/DEBUG   (   32):          #25  pc 0000f880  /system/lib/libc.so
I/DEBUG   (   32):          #26  pc 0000f3f4  /system/lib/libc.so
I/DEBUG   (   32): stack:
I/DEBUG   (   32):     445d97b0  005574c0  [heap]
I/DEBUG   (   32):     445d97b4  0000003f
I/DEBUG   (   32):     445d97b8  00000000
I/DEBUG   (   32):     445d97bc  a9a9a475
I/DEBUG   (   32):     445d97c0  001a6d30  [heap]
I/DEBUG   (   32):     445d97c4  aa1e37b1  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d97c8  445d9814
I/DEBUG   (   32):     445d97cc  aa1e41b9  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d97d0  445d97d8
I/DEBUG   (   32):     445d97d4  aa1dec3d  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d97d8  aa3db598
I/DEBUG   (   32):     445d97dc  445d9824
I/DEBUG   (   32):     445d97e0  00557620  [heap]
I/DEBUG   (   32):     445d97e4  aa1dee0d  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d97e8  df002777
I/DEBUG   (   32):     445d97ec  e3a070ad
I/DEBUG   (   32): #00 445d97f0  445d9da0
I/DEBUG   (   32):     445d97f4  aa3db598
I/DEBUG   (   32):     445d97f8  aa3db598
I/DEBUG   (   32):     445d97fc  445d9998
I/DEBUG   (   32):     445d9800  445d9998
I/DEBUG   (   32):     445d9804  445d986c
I/DEBUG   (   32):     445d9808  00000003
I/DEBUG   (   32):     445d980c  00534318  [heap]
I/DEBUG   (   32):     445d9810  0000007f
I/DEBUG   (   32):     445d9814  aa3db598
I/DEBUG   (   32):     445d9818  ffe0382d
I/DEBUG   (   32):     445d981c  aa1e01f1  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d9820  005c73f8  [heap]
I/DEBUG   (   32):     445d9824  00557620  [heap]
I/DEBUG   (   32):     445d9828  005576c0  [heap]
I/DEBUG   (   32):     445d982c  445d9800
I/DEBUG   (   32):     445d9830  aa3db598
I/DEBUG   (   32):     445d9834  ffce2769
I/DEBUG   (   32):     445d9838  aa0bdd01  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d983c  445d9998
I/DEBUG   (   32):     445d9840  0045f550  [heap]
I/DEBUG   (   32):     445d9844  aa181c7b  /system/lib/libwebcore.so
I/DEBUG   (   32): #01 445d9848  00000000
I/DEBUG   (   32):     445d984c  001cb538  [heap]
I/DEBUG   (   32):     445d9850  00000000
I/DEBUG   (   32):     445d9854  00000071
I/DEBUG   (   32):     445d9858  006c70a8  [heap]
I/DEBUG   (   32):     445d985c  00000000
I/DEBUG   (   32):     445d9860  445d9874
I/DEBUG   (   32):     445d9864  aa182c29  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d9868  005535a8  [heap]
I/DEBUG   (   32):     445d986c  aa2550c9  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d9870  aa07c10d  /system/lib/libwebcore.so
I/DEBUG   (   32):     445d9874  00262648  [heap]
I/DEBUG   (   32):     445d9878  00000000
I/DEBUG   (   32):     445d987c  007bf02c  [heap]
I/DEBUG   (   32):     445d9880  445d9908
I/DEBUG   (   32):     445d9884  0045f550  [heap]
I/DEBUG   (   32):     445d9888  445d9998
I/DEBUG   (   32):     445d988c  aa182c5b  /system/lib/libwebcore.so
I/ActivityManager(   59): Process com.phresheez.phresheez (pid 911) has died.
I/WindowManager(   59): WIN DEATH: Window{432464e0
com.phresheez.phresheez/com.phresheez.phresheez.Phresheez
paused=false}
D/Zygote  (   34): Process 911 terminated by signal (11)
W/InputManagerService(   59): Got RemoteException sending
setActive(false) notification to pid 911 uid 10027

--~--~---------~--~----~------------~-------~--~----~

2. No Market on Samsung i7500 Android

I have just bought Samsung i7500. It's just great, Android is amazing
BUT there is no Market on the menu. How can I install Android Market
to my phone? And why there is not a default market built-in?

--~--~---------~--~----~------------~-------~--~----~

3. Question about adapters

4. Communicate between two threads

5. Please help me !

6. OpenCORE 2.04 bug in OMA1 passthru CPM plugin test

7. OpenCORE build error in Ubuntu 9.04