當前位置: 首頁>>代碼示例>>Java>>正文


Java IntentCompat.makeMainActivity方法代碼示例

本文整理匯總了Java中android.support.v4.content.IntentCompat.makeMainActivity方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentCompat.makeMainActivity方法的具體用法?Java IntentCompat.makeMainActivity怎麽用?Java IntentCompat.makeMainActivity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.content.IntentCompat的用法示例。


在下文中一共展示了IntentCompat.makeMainActivity方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getParentActivityIntent

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
public Intent getParentActivityIntent(Activity paramActivity)
{
  String str = NavUtils.getParentActivityName(paramActivity);
  if (str == null) {
    return null;
  }
  ComponentName localComponentName = new ComponentName(paramActivity, str);
  try
  {
    if (NavUtils.getParentActivityName(paramActivity, localComponentName) == null) {
      return IntentCompat.makeMainActivity(localComponentName);
    }
    Intent localIntent = new Intent().setComponent(localComponentName);
    return localIntent;
  }
  catch (PackageManager.NameNotFoundException localNameNotFoundException)
  {
    Log.e("NavUtils", "getParentActivityIntent: bad parentActivityName '" + str + "' in manifest");
  }
  return null;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:22,代碼來源:NavUtils.java

示例2: getParentActivityIntent

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
@Override
public Intent getParentActivityIntent(Activity activity) {
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(activity, parentName);
    try {
        final String grandparent = NavUtils.getParentActivityName(activity, target);
        final Intent parentIntent = grandparent == null
                ? IntentCompat.makeMainActivity(target)
                : new Intent().setComponent(target);
        return parentIntent;
    } catch (NameNotFoundException e) {
        Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
                "' in manifest");
        return null;
    }
}
 
開發者ID:bestarandyan,項目名稱:ShoppingMall,代碼行數:20,代碼來源:NavUtils.java

示例3: getParentActivityIntent

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
public static Intent getParentActivityIntent(Context context, ComponentName componentname)
{
    String s = getParentActivityName(context, componentname);
    if (s == null)
    {
        return null;
    }
    ComponentName componentname1 = new ComponentName(componentname.getPackageName(), s);
    if (getParentActivityName(context, componentname1) == null)
    {
        return IntentCompat.makeMainActivity(componentname1);
    } else
    {
        return (new Intent()).setComponent(componentname1);
    }
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:17,代碼來源:NavUtils.java

示例4: getParentActivityIntent

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
public static Intent getParentActivityIntent(Context context, ComponentName componentname)
    throws android.content.pm.PackageManager.NameNotFoundException
{
    String s = getParentActivityName(context, componentname);
    if (s == null)
    {
        return null;
    }
    componentname = new ComponentName(componentname.getPackageName(), s);
    if (getParentActivityName(context, componentname) == null)
    {
        return IntentCompat.makeMainActivity(componentname);
    } else
    {
        return (new Intent()).setComponent(componentname);
    }
}
 
開發者ID:Hamz-a,項目名稱:MyCTFWriteUps,代碼行數:18,代碼來源:NavUtils.java

示例5: getParentActivityIntent

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
public Intent getParentActivityIntent(Activity activity) {
    Intent intent = null;
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName != null) {
        ComponentName target = new ComponentName(activity, parentName);
        try {
            intent = NavUtils.getParentActivityName(activity, target) == null ? IntentCompat.makeMainActivity(target) : new Intent().setComponent(target);
        } catch (NameNotFoundException e) {
            Log.e(NavUtils.TAG, "getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest");
        }
    }
    return intent;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:14,代碼來源:NavUtils.java

示例6: onCreate

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    Preferences.applyTheme(this);
    getDelegate().installViewFactory();
    getDelegate().onCreate(savedInstanceState);
    super.onCreate(savedInstanceState);
    //Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    //setSupportActionBar(toolbar);
    //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getFragmentManager().beginTransaction()
            .replace(android.R.id.content, new PreferencesFragment()).commit();

    //addPreferences(R.xml.task_preferences);
    //Preferences.sync(getPreferencesManager());
    mListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
            //Preferences.sync(getPreferenceManager(), key);
            if (key.equals(getString(R.string.pref_theme))) {
                finish();
                //change to launch into activity upon retheme
                final Intent intent = IntentCompat.makeMainActivity(new ComponentName(
                        PreferencesActivity.this, TaskListActivity.class));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(intent);
            }
        }

    };
}
 
開發者ID:bowenchin,項目名稱:RemindrApp-Android,代碼行數:31,代碼來源:PreferencesActivity.java

示例7: onCreate

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    Preferences.applyTheme(this);
    getDelegate().installViewFactory();
    getDelegate().onCreate(savedInstanceState);
    super.onCreate(savedInstanceState);
    setToolbar();
    addPreferencesFromResource(R.xml.preferences);
    Preferences.sync(getPreferenceManager());
    mListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
            Preferences.sync(getPreferenceManager(), key);
            if (key.equals(getString(R.string.pref_theme))) {
                finish();
                //change to launch into activity upon retheme
                final Intent intent = IntentCompat.makeMainActivity(new ComponentName(
                        SettingsActivity.this, TaskListActivity.class));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(intent);
            }
            /*if(key.equals(R.string.pref_help)){
                finish();
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://android.bowenchin.com")));
            }*/
        }
    };

    findPreference(getApplicationContext().getString(R.string.title_instructions)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent = new Intent(SettingsActivity.this, WalkThroughActivity.class);
            startActivity(intent);
            return false;
        }
    });
}
 
開發者ID:bowenchin,項目名稱:MaterialTasksApp-Android,代碼行數:38,代碼來源:SettingsActivity.java

示例8: restartApp

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
/**
 * Restarts app.
 *
 * @param activity the activity
 */
public static void restartApp(Activity activity) {
    activity.finish();
    ComponentName componentName = new ComponentName(activity, WeekScheduleActivity.class);
    final Intent intent = IntentCompat.makeMainActivity(componentName);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    activity.startActivity(intent);
}
 
開發者ID:drymarev,項目名稱:rxbsuir,代碼行數:13,代碼來源:Utils.java

示例9: onBackPressed

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
    if(restart) {
        super.onBackPressed();
        final Intent intent = IntentCompat.makeMainActivity(new ComponentName(
                AppSettingsActivity.this, MainActivity.class));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    } else
        super.onBackPressed();
}
 
開發者ID:ThatKawaiiGuy,項目名稱:Handbook_for_Melee,代碼行數:12,代碼來源:AppSettingsActivity.java

示例10: getParentActivityIntent

import android.support.v4.content.IntentCompat; //導入方法依賴的package包/類
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} <meta-data>
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for sourceActivityClass
 * @param sourceActivityClass {@link java.lang.Class} object for an Activity class
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context,
            new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(context, parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
開發者ID:groupsky,項目名稱:android-recipes-app,代碼行數:25,代碼來源:NavUtils.java


注:本文中的android.support.v4.content.IntentCompat.makeMainActivity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。