mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
add logging; fix NPE
Running into a case where views haven't been added to the layout yet but I'm searching there for their associated fragments. Fix to NPE stops a crash, but intents still aren't being handled. I need to try to handle them later, but am unsure when to start trying.
This commit is contained in:
parent
bd2fbdeb88
commit
95d147d9c3
2 changed files with 16 additions and 5 deletions
|
@ -570,11 +570,16 @@ public class DelegateBase implements DlgClickNotify,
|
|||
|
||||
protected boolean isVisible() { return m_isVisible; }
|
||||
|
||||
protected boolean canHandleNewIntent( Intent intent ) { return false; }
|
||||
protected boolean canHandleNewIntent( Intent intent )
|
||||
{
|
||||
DbgUtils.logdf( "%s.canHandleNewIntent() => false",
|
||||
getClass().getSimpleName(), intent.toString() );
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void handleNewIntent( Intent intent ) {
|
||||
DbgUtils.logf( "%s.handleNewIntent(%s): not handling",
|
||||
getClass().getSimpleName(), intent.toString() );
|
||||
DbgUtils.logdf( "%s.handleNewIntent(%s): not handling",
|
||||
getClass().getSimpleName(), intent.toString() );
|
||||
}
|
||||
|
||||
protected void runWhenActive( Runnable proc )
|
||||
|
|
|
@ -209,6 +209,9 @@ public class MainActivity extends XWActivity
|
|||
popIntoView( frag );
|
||||
frag.getDelegate().handleNewIntent( intent );
|
||||
}
|
||||
} else {
|
||||
DbgUtils.logdf( "no fragment for child %s indx %d",
|
||||
child.getClass().getSimpleName(), ii );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,9 +367,12 @@ public class MainActivity extends XWActivity
|
|||
|
||||
private XWFragment getTopFragment()
|
||||
{
|
||||
XWFragment frag = null;
|
||||
View child = m_root.getChildAt( m_root.getChildCount() - 1 );
|
||||
XWFragment frag = (XWFragment)getSupportFragmentManager()
|
||||
.findFragmentById( child.getId() );
|
||||
if ( null != child ) {
|
||||
frag = (XWFragment)getSupportFragmentManager()
|
||||
.findFragmentById( child.getId() );
|
||||
}
|
||||
return frag;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue