本文整理匯總了Java中android.support.v4.app.NavUtils.getParentActivityName方法的典型用法代碼示例。如果您正苦於以下問題:Java NavUtils.getParentActivityName方法的具體用法?Java NavUtils.getParentActivityName怎麽用?Java NavUtils.getParentActivityName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.app.NavUtils
的用法示例。
在下文中一共展示了NavUtils.getParentActivityName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onOptionsItemSelected
import android.support.v4.app.NavUtils; //導入方法依賴的package包/類
/**
* Customize option bar
* @param item
* @return
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch( item.getItemId() ){
case android.R.id.home:
if ( NavUtils.getParentActivityName(getActivity()) != null){
NavUtils.navigateUpFromSameTask(getActivity());
}
return true;
case edu.osu.siyang.smartform.R.id.menu_item_delete_single_test:
AlertDialog diaBox = AskOption();
diaBox.show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例2: hasParentActivity
import android.support.v4.app.NavUtils; //導入方法依賴的package包/類
private static boolean hasParentActivity(Activity activity) {
try {
return NavUtils.getParentActivityName(activity) != null;
} catch (IllegalArgumentException e) {
// Component name of supplied activity does not exist...
return false;
}
}
示例3: onOptionsItemSelected
import android.support.v4.app.NavUtils; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case android.R.id.home:
if(NavUtils.getParentActivityName(this)!=null){
NavUtils.navigateUpFromSameTask(this);
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例4: onOptionsItemSelected
import android.support.v4.app.NavUtils; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()){
case android.R.id.home:
if(NavUtils.getParentActivityName(this)!=null){
NavUtils.navigateUpFromSameTask(this);
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例5: onOptionsItemSelected
import android.support.v4.app.NavUtils; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case android.R.id.home:
if(NavUtils.getParentActivityName(this)!=null){
makeResult(RESULT_CANCELED);
NavUtils.navigateUpFromSameTask(this);
}
hideKeyboard(mToDoTextBodyEditText);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例6: onCreate
import android.support.v4.app.NavUtils; //導入方法依賴的package包/類
public void onCreate(Bundle savedInstanceState) {
if ((this.mOriginalWindowCallback instanceof Activity) && NavUtils.getParentActivityName((Activity) this.mOriginalWindowCallback) != null) {
ActionBar ab = peekSupportActionBar();
if (ab == null) {
this.mEnableDefaultActionBarUp = true;
} else {
ab.setDefaultDisplayHomeAsUpEnabled(true);
}
}
}