示例#1
0
 public static Intent getParentActivityIntent(Context paramContext, Class<?> paramClass)
     throws PackageManager.NameNotFoundException {
   String str = getParentActivityName(paramContext, new ComponentName(paramContext, paramClass));
   if (str == null) {
     return null;
   }
   ComponentName localComponentName = new ComponentName(paramContext, str);
   if (getParentActivityName(paramContext, localComponentName) == null) {
     return IntentCompat.makeMainActivity(localComponentName);
   }
   return new Intent().setComponent(localComponentName);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    Toolbar toolbar = getToolbar();
    if (toolbar != null) {
      toolbar.setTitle(R.string.title_settings);
      toolbar.setNavigationIcon(R.drawable.ic_up);
      toolbar.setNavigationOnClickListener(
          view ->
              navigateUpToFromChild(
                  PreferenceActivity.this,
                  IntentCompat.makeMainActivity(
                      new ComponentName(PreferenceActivity.this, BrowseMoviesActivity.class))));
    }

    if (savedInstanceState == null) {
      getFragmentManager().beginTransaction().add(R.id.container, new SettingsFragment()).commit();
    }
  }
示例#3
0
 public Intent getParentActivityIntent(Activity paramActivity) {
   String str = NavUtils.getParentActivityName(paramActivity);
   if (str == null) {
     return null;
   }
   ComponentName localComponentName = new ComponentName(paramActivity, str);
   Object localObject;
   try {
     if (NavUtils.getParentActivityName(paramActivity, localComponentName) == null) {
       localObject = IntentCompat.makeMainActivity(localComponentName);
     } else {
       Intent localIntent = new Intent().setComponent(localComponentName);
       localObject = localIntent;
     }
   } catch (PackageManager.NameNotFoundException localNameNotFoundException) {
     Log.e(
         "NavUtils",
         "getParentActivityIntent: bad parentActivityName '" + str + "' in manifest");
     return null;
   }
   return localObject;
 }
    @Override
    protected void onPostExecute(Boolean aBoolean) {
      super.onPostExecute(aBoolean);

      if (aBoolean) {
        progressDialog.dismiss();
        Intent intent = new Intent(MySplash.this, MyLogin.class);
        ComponentName cn = intent.getComponent();
        Intent intent1 = IntentCompat.makeRestartActivityTask(cn);
        startActivity(intent1);
        // startActivity(intent);
      } else {
        progressDialog.dismiss();
        Toast.makeText(
                MySplash.this,
                "Sorry..."
                    + "\n"
                    + "Internet Connection or IMEI verificaion might be the problem !",
                Toast.LENGTH_LONG)
            .show();
        onStop();
      }
    }