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. When will Google supply the 64bit support for Mac Platform?

Snow Leopard has been published for several weeks, Eclipse also
provide an 64bit Cocoa version on 3.5, but the Android SDK still only
support the 32bit mode on Mac, why? It's emulator also still use
QuickDraw to draw interface, maybe Google has forgotten us...

Please! Give us an 64bit version SDK, like Windows and Linux, Please!

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

2. emulator debugging option for proxy problems.

I'm having problems debugging networking with the emulator.

I'm on a Fedora 8 system, using the emulator I built from a full repo
checkout and build
as of Sep 4.  I get the same problem with an emulator from the 1.5 released
SDK.
I'm behind a firewall, and when I launch the browser and try to connect to
the
Google site from within the emulator, I get a popup saying "No network
connection
the page will continue loading after the network connection has been
restored".
The browser itself says "Web page not available".

Issue one:
I tried following the instructions at:
http://developer.android.com/guide/developing/tools/emulator.html
to debug my proxy connection.  On that page, in the section
"Using the Emulator with a Proxy" it says to use the '-verbose-proxy'
option.  I could find no such option in the emulator.  I found a e-mail
exchange that referenced the '-debug-proxy' option, which seems to
help with this.

I believe the emulator.html web page has the wrong name for the
option to use to debug the emulator proxy.  I believe it should be
changed to '-debug-proxy'.

Issue two:
The '-debug-proxy' was not listed by the emulator as one of its
options when '-help' is used to display emulator options.


Issue three:
I could not connect through my company proxy and get valid
data back from www.google.com.  I used the -debug-proxy
emulator option, and it gave me the information below.

My proxy is splitting the response into multiple packets.
I used wireshark to see the packets, and the TCP response
from my desktop to the proxy server included several
TCP RST commands.  I didn't save the trace, but I can
reproduce this if it would help.

Does anyone know if there is a known bug in the emulator
proxy-handling in the internal firewall/router?

Thanks,
 -- Eric


-debug-proxy messages:
-------------------------------
http_service_connect: trying to connect to 74.125.159.104:80
http_service_connect: using HTTP rewriter
tcp:74.125.159.104:80(16): connecting
tcp:74.125.159.104:80(16): connected to proxy
tcp:74.125.159.104:80(16): socket pair created
tcp:74.125.159.104:80(16): received 'GET /m?client=ms-android-google
HTTP/1.1'
tcp:74.125.159.104:80(16): request first line ok
tcp:74.125.159.104:80(16): received 'Host: www.google.com'
tcp:74.125.159.104:80(16): received 'Accept-Encoding: gzip'
tcp:74.125.159.104:80(16): received 'Accept:
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
tcp:74.125.159.104:80(16): received 'User-Agent: Mozilla/5.0 (Linux; U;
Android Donut; en-us; generic Build/Donut) AppleWebKit/528.5+ (KHTML, like
Gecko) Version/3.1.2 Mobile Safari/525.20.1'
tcp:74.125.159.104:80(16): received 'Cookie:
PREF=ID=7f73ef02e9116035:TM=1252109542:LM=1252109542:S=yw0YmjPKJ1426GiC;
MPRF=H4sIAAAAAAAAAKs4vGf_050qXUwMk5gUDCyNTc3MjVJMUkzNUo2STCwt08wSgbShiWGygZlBCgDu19sFLQAAAA'
tcp:74.125.159.104:80(16): received 'Accept-Language: en-US'
tcp:74.125.159.104:80(16): received 'Accept-Charset: utf-8, iso-8859-1,
utf-16, *;q=0.7'
tcp:74.125.159.104:80(16): received ''
tcp:74.125.159.104:80(16): request headers ok
tcp:74.125.159.104:80(16): sending 615 bytes:

tcp:74.125.159.104:80(16): request sent, waiting for reply
tcp:74.125.159.104:80(16): received 'HTTP/1.1 200 OK'
tcp:74.125.159.104:80(16): reply first line ok
tcp:74.125.159.104:80(16): received 'Cache-Control: private,
max-age=1209600'
tcp:74.125.159.104:80(16): received 'Content-Type: text/html; charset=UTF-8'
tcp:74.125.159.104:80(16): received 'Date: Wed, 09 Sep 2009 02:56:23 GMT'
tcp:74.125.159.104:80(16): received 'X-Content-Type-Options: nosniff'
tcp:74.125.159.104:80(16): received 'Server: GFE/2.0'
tcp:74.125.159.104:80(16): received 'Expires: Wed, 09 Sep 2009 02:56:23 GMT'
tcp:74.125.159.104:80(16): received 'Transfer-Encoding: chunked'
tcp:74.125.159.104:80(16): received 'Proxy-Connection: Keep-Alive'
tcp:74.125.159.104:80(16): received 'Connection: Keep-Alive'
tcp:74.125.159.104:80(16): received 'Content-Encoding: gzip'
tcp:74.125.159.104:80(16): received 'Set-Cookie:
MPRF=H4sIAAAAAAAAAKu4-uv1050qXUwMk5gUDCyNTc3MjVJMUkzNUo2STCwt08wSgbShiWGygZlBCgCszU4MLQAAAA;
expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com'
tcp:74.125.159.104:80(16): received ''
tcp:74.125.159.104:80(16): reply headers ok
tcp:74.125.159.104:80(16): sending 505 bytes:

tcp:74.125.159.104:80(16): body_length=0 body_mode=CHUNKED
tcp:74.125.159.104:80(16): reply sent, waiting for body
tcp:74.125.159.104:80(16): waiting chunk header
tcp:74.125.159.104:80(16): received 'A'
tcp:74.125.159.104:80(16): received 10 bytes:
<< 1f 8b 08 00 00 00 00 00 00 00                      ..........

tcp:74.125.159.104:80(16): chunk completed (0 bytes)
tcp:74.125.159.104:80(16): sending 11 bytes:

tcp:74.125.159.104:80(16): sent closed=0 data=0 n=0 ret=0
tcp:74.125.159.104:80(16): waiting chunk header
tcp:74.125.159.104:80(16): received ''
tcp:74.125.159.104:80(16): blocked
tcp:74.125.159.104:80(16): received '4183'
tcp:74.125.159.104:80(16): can't parse header '4183'

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

3. process com.microjobsinc.mjandroid has stoped unexpectly

4. Problems with SimpleCursorAdapter

5. How do you center a TextView inside a layout?

6. Is there any gmail API for android now?

7. Which factor decide resource in folder 320x240 be used.