StartActivityForResult is a method of Activity, not Context. You can
typecast if appropriate.

If not (i.e. your Context is a service or a receiver), then it doesn't make
sense - because the result callback used by startActivityForResult is also a
method of Activity.

If this case, use a broadcast, a pending intent, or a handler message (just
some of the options) to send/receive the result.

Oh, and I see that the intent you're trying to start is for a service. Using
startActivity (for result or not) with a service intent just doesn't make
sense.
20.05.2011 1:41 пользователь "kypriakos" <demet...@ece.neu.edu> написал:
>
> 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 ...
>
> On May 19, 2:12 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
>> Huh?
>>
>> http://developer.android.com/reference/android/app/Activity.html#star...,
>> 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
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to