本文整理匯總了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);
}
}