本文整理汇总了Java中android.support.v4.app.NavUtils.navigateUpFromSameTask方法的典型用法代码示例。如果您正苦于以下问题:Java NavUtils.navigateUpFromSameTask方法的具体用法?Java NavUtils.navigateUpFromSameTask怎么用?Java NavUtils.navigateUpFromSameTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.NavUtils
的用法示例。
在下文中一共展示了NavUtils.navigateUpFromSameTask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
try {
switch (item.getItemId()) {
case R.id.howToItem:
Common.previousActivity = KeyboardDimensionActivity.class;
Intent howToIntent = new Intent(this, WebViewActivity.class);
howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
howToIntent.putExtra("web_url", getString(R.string.how_to_link));
startActivity(howToIntent);
break;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
示例2: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
//noinspection SimplifiableIfStatement
if (id == android.R.id.home) {
NavUtils.navigateUpFromSameTask(this);
}
return super.onOptionsItemSelected(item);
}
示例3: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
try {
switch (item.getItemId()) {
case R.id.howToItem:
Common.previousActivity = DotsLayoutActivity.class;
Intent howToIntent = new Intent(this, WebViewActivity.class);
howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
howToIntent.putExtra("web_url", getString(R.string.how_to_link));
startActivity(howToIntent);
break;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
示例4: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
try {
switch (item.getItemId()) {
case R.id.howToItem:
Common.previousActivity = KeyboardLanguagesActivity.class;
Intent howToIntent = new Intent(this, WebViewActivity.class);
howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
howToIntent.putExtra("web_url", getString(R.string.how_to_link));
startActivity(howToIntent);
break;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
示例5: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
try {
switch (item.getItemId()) {
case R.id.howToItem:
Common.previousActivity = AdvancedActivity.class;
Intent howToIntent = new Intent(this, WebViewActivity.class);
howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
howToIntent.putExtra("web_url", getString(R.string.how_to_link));
startActivity(howToIntent);
break;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
示例6: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home){
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
示例7: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
// When the home button is pressed, take the user back to the VisualizerActivity
if (id == android.R.id.home) {
NavUtils.navigateUpFromSameTask(this);
}
return super.onOptionsItemSelected(item);
}
示例8: onMenuItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
if (!super.onMenuItemSelected(featureId, item)) {
NavUtils.navigateUpFromSameTask(this);
}
return true;
}
return super.onMenuItemSelected(featureId, item);
}
示例9: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
// This ID represents the Home or Up button.
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
示例10: 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);
}
}
示例11: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
NavUtils.navigateUpFromSameTask(this.getActivity());
return true;
}
return super.onOptionsItemSelected(item);
}
示例12: onMenuItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
if (!super.onMenuItemSelected(featureId, item)) {
NavUtils.navigateUpFromSameTask(this);
}
return true;
}
return super.onMenuItemSelected(featureId, item);
}
示例13: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(@NonNull final MenuItem item)
{
switch (item.getItemId())
{
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
示例14: onOptionsItemSelected
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例15: goBack
import android.support.v4.app.NavUtils; //导入方法依赖的package包/类
private void goBack(){
if(wvMainWeb!=null && wvMainWeb.canGoBack()){
wvMainWeb.goBack();
}else{
NavUtils.navigateUpFromSameTask(this);
}
}