[android-developers] Digest for android-developers@googlegroups.com - 25 Messages in 10 Topics

Group: http://groups.google.com/group/android-developers/topics

    plnelson <pnartg@gmail.com> Mar 29 01:16PM -0700  

    Over many projects I've run into various problems with Activities doing
    mysterious things. I've had them not start; I've had onActivityResult not
    get called when I'm trying to send parameters back from an Activity; I've
    had onActivityResult get called *instantly* before the other Activity even
    got created. Googling the web I see that lots of people have these
    problems and often these either stump people on StackOverflow or result in
    random "superstitious" fixes with no obvious basis - even if they sometimes
    seem to work.

    So* My Question*: is there any *systematic* way to debug Activity
    life-cycle problems - are there log files, traces, dumps, or anything that
    programmers can use to figure out why something is happening. If I call
    "startActivity" and the activity is never created or started, is there
    anyplace Android tells us why? If onActivityResult is called prematurely
    (i.e., before the Activity that's supposed to return the result even
    exists) how can we find out why it was called? Are there any hints of
    tricks to interpreting the call stack that can shed light on that?
     
    Thanks in advance for any tips or tricks.

     

    Streets Of Boston <flyingdutchie@gmail.com> Mar 29 02:56PM -0700  

    Look at your logcat. It tells you when an activity hasn't started.
    For the onActivityResult getting called instantly: Your returning activity
    was probably started with a singleTask or singleInstance. This means that
    onActivityResult was called immediately after your activity was started
    (and not upon its return). Use default/standard instead.
     
    On Friday, March 29, 2013 4:16:53 PM UTC-4, plnelson wrote:

     

    plnelson <pnartg@gmail.com> Mar 29 03:23PM -0700  

    On Friday, March 29, 2013 5:56:18 PM UTC-4, Streets Of Boston wrote:
     
    > Look at your logcat. It tells you when an activity hasn't started.
     
     
    When an activity fails to start all I see in LogCat is .. *nothing* related
    to that Activity. If the Activity is created or started (or paused, etc) *
    then* I see it in Logcat. Are you saying that I should see a message
    saying that the Activity failed to start or be created? I run LogCat in
    verbose mode with no filters on.
     

     
    > was probably started with a singleTask or singleInstance. This means that
    > onActivityResult was called immediately after your activity was started
    > (and not upon its return). Use default/standard instead.
     
    In that particular example the returning Activity was standard but the
    Activity *invoking* it was singleInstance. I knew the returning Activity
    had to be standard but I only found out that the caller couldn't be
    singleInstance by time-consuming trial-and-error. I've never seen it
    documented. When I made the caller activity also standard it
    worked. Which illustrates my question: which is whether there's a
    way to *systematically* find out from Android what happened. Is any of
    this stuff instrumented so we can see why something did or did not happen?
     
    I'm currently trying to debug a case where I can ONLY start an activity if
    it's singleInstance. I don't know why and lots of people on StackOverflow
    have made many guesses and suggestions, none of which (as of this writing)
    have worked. Because we're all fumbling in the dark since we don't know
    what Android is doing behind the scenes. I want to know if there's a way
    to find out.

     

    plnelson <pnartg@gmail.com> Mar 29 01:02PM -0700  

    This question has (so far) stumped them on Stack Overflow. . . .
     
    I'm trying to launch an Activity which launches *perfectly fine* when its
    launchMode is set to *singleInstance*. When I change it to *standard*nothing happens; it never gets to onCreate (or onStart or onResume, or
    anyplace in the target Activity - I've overridden all the lifycycle events
    and set breakpoints)
     
    if (DGraphActivity.bitmap != null) {
    Intent intent = new Intent(ctx, DGraphActivity.class);
    intent.putExtra("Buttons", sButtonParam);
    try {
    ctx.startActivity(intent);
    }
    catch (Exception e) {
    Log.d("Commands", "failed to start DGraphActivity");
    }}
     
    in the manifest . . .
     
    <activity android:name="DGraphActivity"
    android:screenOrientation="portrait"
    android:launchMode="standard"></activity>
     
    I need the DGraphActivity launchMode to be *standard* because it will be
    launching another activity and using onActivityResult to collect the
    response and onActivityResult doesn't work with activites launched in
    singleInstance launchMode.
     
    I have lots of other Activities with *standard* launchMode that launch
    perfectly well, I can't figure out what's different about this one. Thanks
    in advance!

     

    RichardC <richard.critten@googlemail.com> Mar 29 02:45PM -0700  

    Technically it needs a "." here:
     
    <activity android:name=".DGraphActivity"
     
    ^
    or the full package name.
     
    On Friday, March 29, 2013 8:02:04 PM UTC, plnelson wrote:

     

    Streets Of Boston <flyingdutchie@gmail.com> Mar 29 02:57PM -0700  

    Look at your logcat and see why your activity can't be started. Could be as
    simple as a typo in your manifest.
     
    On Friday, March 29, 2013 4:02:04 PM UTC-4, plnelson wrote:

     

    xrd <xrdawson@gmail.com> Mar 29 02:53PM -0700  

    I'm trying to get a fragment working such that when the fragment is brought
    into view it refreshes the content in the view.
     
    I thought that I could implement OnPageChangeListener and
    override onPageSelected but my breakpoint is never hit. Is there a better
    way? Or, perhaps this means I am doing things wrong somewhere in my code?
     
    I've also tried using onResume(), but this does not get called each time
    the fragment is displayed, which is what I need.
     
    Any suggestions?

     

    Tobiah <toby@tobiah.org> Mar 29 01:04PM -0700  

    I'm launching another app from my app like this:
     
    Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.other.appname");
    startActivityForResult(LaunchIntent, EXPOSMART_MESSAGE);
     
    Then I set a result from the launched app:
     
    Intent response = new Intent();
    response.putExtra("exit_flag", "y");
    setResult(RESULT_OK, response);
    finish();
     
    I was expecting onActivityResult() to get called in the original
    app, but it never does. Is there something different about launching
    other apps rather than just new activities in the same app?
     
    Thanks!
     
    Toby

     

    Tobiah <toby@tobiah.org> Mar 29 02:06PM -0700  

    On 03/29/2013 01:52 PM, RichardC wrote:
    > Does the other App call setResult() ?
     
    Yeah, It's shown in the code below.
     
    Thanks,
     
    Tobiah
     

     

    tom_mai78101 <tom.mai78101@gmail.com> Mar 29 12:23AM -0700  

    I'm looking around on Youtube for tutorial videos on how to use OpenGL ES
    2.0 for Android, and I see that there aren't any available online. I'm not
    exactly looking at using OpenGL ES 1.X, but I'm okay with it. It's just
    that the number of OpenGL ES 2.0 tutorials are somewhat few and rare.

    I know that there are websites and blogs that teaches you OpenGL ES 2.0,
    how to use them, and how to work with shaders and things like that. Well, I
    did followed a few of their tutorials, and this is what I got from them.

    The attached ZIP file is my current OpenGL ES 2.0 project that I
    self-taught myself just by reading the online tutorials about OpenGL ES
    2.0. The results aren't exactly like what I anticipated.

    I'm already into lesson 2, displaying a 3D model mesh. It was supposed to
    show up as a regular green cube mesh, with no lightings and textures. The
    actual result I got is a flatten pyramid with its top cut off, like this
    shown below:






    <http://www.sketchup.com/crimages/bm-154069-FlatTopRoofBlock.jpg>

    Since I don't know why a cube looked like in the picture above, and not
    like a regular shaped cube, I figured I try looking up a video to see how
    OpenGL ES 2.0 for Android was coded in real-time.

    It's a letdown when what I (supposedly) typed in doesn't look what I
    expected, and that there's no clue to how it happens like that. Which leads
    me to question the problem with the lack of OpenGL ES 2.0 video tutorials.
    They help tremendously when the program was coded and run in real-time,
    from another developer's perspective.

    So, why the lack of these video tutorials? Thanks in advance.

    --------------------

    Or you know, if someone is willing to help me debug and solve the problem,
    I'll be even more happier to let that person to help me out, and teach me
    something I don't know or didn't grasp when I was learning it myself. That
    would be grateful.

     

    tom_mai78101 <tom.mai78101@gmail.com> Mar 29 12:36PM -0700  

    I have seen it, but it doesn't answer my question. Why aren't OpenGL ES 2.0 video tutorials available on the net?

     

    bergstr <sell.bergstr11@gmail.com> Mar 29 11:17AM -0700  

    ok, I have changed the code such that the frequent calls into native code
    (in method validateKey) don't happen any longer. They were unneeded anyway,
    as the internal cleanup thread can safely assume that the keys are valid.
    With this change, I can no longer reproduce this issue.
     
    However, I am still left with the impression that Android may at any point
    suspend background threads in favor of the UI thread regardless of their
    state and whether they hold locks. If this is true, it imposes very hard
    requirements on the programmer to avoid cases where lock contention between
    the UI thread and a background thread can lead to a deadlock, as in my
    case. At the very least, I would expect this to be documented somewhere,
    preferably in a prominent place..
     
    chris

     

    Pratama Nur Wijaya <set.mnemonix@gmail.com> Mar 29 04:10AM -0700  

    thanks for your advice..
     
    On Friday, 29 March 2013 13:49:56 UTC+7, skink wrote:

     

    skink <pskink@gmail.com> Mar 29 08:35AM -0700  

    Pratama Nur Wijaya wrote:
     
    > map = mapFragment.getMap();
     
    > i'm tested my apps on Emulator api level 17
     
    post your activity_
    bank_location.xml layout file
     
    pskink

     

    Pratama Nur Wijaya <set.mnemonix@gmail.com> Mar 29 08:42AM -0700  

    here http://pastebin.com/DpWSTnr9
     
    On Friday, 29 March 2013 22:35:38 UTC+7, skink wrote:

     

    Jonathan S <xfsunoles@gmail.com> Mar 29 09:15AM -0700  

    Looks like Google Play services is not available in your tablet.
     
    On Friday, March 29, 2013 11:11:49 AM UTC-4, Pratama Nur Wijaya wrote:

     

    Pratama Nur Wijaya <set.mnemonix@gmail.com> Mar 29 09:38AM -0700  

    thanks for everyone here.. ^_^
     
    now its work on my tablet..
    i have change my code like these http://pastebin.com/hS0tKLEY
     
    i think i have got some logic error on these..
     
    if (map == null)
    {
    Utils.TRACE("API " + Build.VERSION.SDK_INT);
    FragmentManager fragmentManager = getSupportFragmentManager();
    SupportMapFragment supportMapFragment = (SupportMapFragment)
    fragmentManager.findFragmentById(R.id.map);
    map = supportMapFragment.getMap();
     
    if (map != null)
    {
    setupMap();
    }
    }
     
    On Friday, 29 March 2013 23:30:55 UTC+7, skink wrote:

     

    bob <bob@coolfone.comze.com> Mar 29 07:26AM -0700  

    Perhaps you should see this tip about "*largeHeap*":
     
    http://knowledge.lapasa.net/?p=772
     
    Thanks.
     
     
    On Thursday, March 28, 2013 1:41:27 PM UTC-5, Nathan wrote:

     

    Arun Kumar K <arunkumar.k@npcompete.net> Mar 29 06:18PM +0530  

    Hi guys,
     
    I have one doubt in activity.i want a call back when activity is destroyed
    from the stack.My constrain is
     
    1.Without using any inbuilt function like( onDestroy,finish and all)
     
    My another doubt is For example:
     
    ActivityA,ActivityB if i go to activityB from activityA then i go to
    activityA from activityB how can i find to reached the activityA.My
    constrain is
     
    1.Without using any inbuilt function like( onStart)
     
    --
    *Thanks & Regards*
    *K.Arun Kumar*

     

    bob <bob@coolfone.comze.com> Mar 29 07:17AM -0700  

    Why can't you use a built-in function?
     
     
    Thanks.
     
     
     
    On Friday, March 29, 2013 7:48:00 AM UTC-5, Arun Kumar K wrote:

     

You received this message because you are subscribed to the Google Group android-developers.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

--
--
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+unsubscribe@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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment