コード例 #1
1
 public void enforceLocale(Activity activity) {
   Configuration config = activity.getBaseContext().getResources().getConfiguration();
   if (!mLocale.equals(config.locale)) {
     config.locale = mLocale;
     activity.getBaseContext().getResources().updateConfiguration(config, null);
   }
 }
コード例 #2
1
 /**
  * 重启本应用
  *
  * @param activity
  */
 public void restartApplication(Activity activity) {
   Intent i =
       activity
           .getBaseContext()
           .getPackageManager()
           .getLaunchIntentForPackage(activity.getBaseContext().getPackageName());
   i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   activity.startActivity(i);
 }
コード例 #3
1
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   context = activity.getBaseContext();
   rQueue = SingleRequestQueue.getRequestQueue(context);
   deviceData = new DeviceData(context);
 }
コード例 #4
1
ファイル: CommonUtils.java プロジェクト: tae1560/battler_dog
  public static String get_uuid(Activity act) {
    String tmDevice = null, tmSerial = null, androidId = null;
    int tmDevice_hash = 0, tmSerial_hash = 0, androidId_hash = 0;
    try {
      final TelephonyManager tm =
          (TelephonyManager) act.getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
      tmDevice = "" + tm.getDeviceId();
      tmSerial = "" + tm.getSimSerialNumber();
      tmDevice_hash = tmDevice.hashCode();
      tmSerial_hash = tmSerial.hashCode();
    } catch (Exception e) {
      e.printStackTrace();
    }
    try {
      androidId =
          ""
              + android.provider.Settings.Secure.getString(
                  act.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
      androidId_hash = androidId.hashCode();
    } catch (Exception e) {
      e.printStackTrace();
    }

    UUID deviceUuid = new UUID(androidId_hash, ((long) tmDevice_hash << 32) | tmSerial_hash);

    return deviceUuid.toString();
  }
コード例 #5
1
ファイル: TapjoyPlugin.java プロジェクト: apostolp/tapjoy
  public void onCreate(Activity activity, Bundle savedInstanceState) {
    PackageManager manager = activity.getBaseContext().getPackageManager();
    String[] keys = {"tapjoyAppID", "tapjoySecretKey"};
    try {
      Bundle meta =
          manager.getApplicationInfo(
                  activity.getApplicationContext().getPackageName(), PackageManager.GET_META_DATA)
              .metaData;
      for (String k : keys) {
        if (meta.containsKey(k)) {
          manifestKeyMap.put(k, meta.get(k).toString());
        }
      }
    } catch (Exception e) {
      logger.log("Exception while loading manifest keys:", e);
    }

    String tapJoyAppID = manifestKeyMap.get("tapjoyAppID");
    String tapJoySecretKey = manifestKeyMap.get("tapjoySecretKey");

    logger.log("{tapjoy} Installing for appID:", tapJoyAppID);

    // Enables logging to the console.
    // TapjoyLog.enableLogging(true);

    // Connect with the Tapjoy server.
    TapjoyConnect.requestTapjoyConnect(_ctx, tapJoyAppID, tapJoySecretKey);
  }
コード例 #6
1
    // Get IOB and COB only, dont update chart
    public static JSONObject getIOBCOB(Activity a) {

      List<Stats> statList = Stats.updateActiveBarChart(a.getBaseContext());
      JSONObject reply = new JSONObject();

      if (statList.size() > 0) {
        try {
          reply.put("iob", String.format(Locale.ENGLISH, "%.2f", statList.get(0).iob));
          reply.put("cob", String.format(Locale.ENGLISH, "%.2f", statList.get(0).cob));
        } catch (JSONException e) {
          Crashlytics.logException(e);
          e.printStackTrace();
        }
        return reply;
      } else {
        try {
          reply.put("iob", String.format(Locale.ENGLISH, "%.2f", 0.00));
          reply.put("cob", String.format(Locale.ENGLISH, "%.2f", 0.00));
        } catch (JSONException e) {
          Crashlytics.logException(e);
          e.printStackTrace();
        }
        return reply;
      }
    }
コード例 #7
0
ファイル: FileUtils.java プロジェクト: FRC2706/KnightWatch
  /**
   * Constructor
   *
   * @param activity This will be used to fetch string contants for file storage and displaying
   *     toasts. Also, if this is a MainActivity, then this activity's .updateDataSyncLabel() will
   *     be called when a Drive connection either suceeds or fails.
   */
  public FileUtils(Activity activity) {
    mActivity = activity;
    m_me = this;

    // store string constants and preferences in member variables just for cleanliness
    // (since the strings are `static`, when any instances of FileUtils update these, all instances
    // will get the updates)
    SharedPreferences SP =
        PreferenceManager.getDefaultSharedPreferences(mActivity.getBaseContext());
    mRemoteToplevelFolderName = activity.getString(R.string.FILE_TOPLEVEL_DIR);
    mRemoteTeamFolderName =
        SP.getString(
            mActivity.getResources().getString(R.string.PROPERTY_googledrive_teamname),
            "<Not Set>");
    mRemoteEventFolderName =
        SP.getString(
            mActivity.getResources().getString(R.string.PROPERTY_googledrive_event), "<Not Set>");
    mRemoteTeamPhotosFolderName = "Team Photos";

    mLocalToplevelFilePath = "/sdcard/" + mRemoteToplevelFolderName;
    mLocalTeamFilePath = mLocalToplevelFilePath + "/" + mRemoteTeamFolderName;
    mLocalEventFilePath = mLocalTeamFilePath + "/" + mRemoteEventFolderName;
    mLocalTeamPhotosFilePath = mLocalTeamFilePath + "/" + mRemoteTeamPhotosFolderName;

    checkLocalFileStructure();
    reset_mGoogleApiClient();
  }
コード例 #8
0
  public static String getDeviceUuId(Activity context) {

    String UUID = "";
    String android_id =
        Secure.getString(context.getApplicationContext().getContentResolver(), Secure.ANDROID_ID);
    Log.i("System out", "android_id : " + android_id);

    final TelephonyManager tm =
        (TelephonyManager) context.getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);

    if (tm != null) {
      final String tmDevice, tmSerial, androidId;
      tmDevice = "" + tm.getDeviceId();
      Log.i("System out", "tmDevice : " + tmDevice);
      tmSerial = "" + tm.getSimSerialNumber();
      Log.i("System out", "tmSerial : " + tmSerial);
      androidId =
          ""
              + android.provider.Settings.Secure.getString(
                  context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);

      UUID deviceUuid =
          new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
      UUID = deviceUuid.toString();
      Log.i("System out", "UUID : " + UUID);
      return UUID;
    }
    return UUID;
  }
コード例 #9
0
    // Updates Stats
    public static JSONObject updateChart(Activity a) {

      JSONObject reply = new JSONObject();
      List<Stats> statList = Stats.updateActiveBarChart(a.getBaseContext());

      if (iobcobChart != null || statList != null || statList.size() > 0) {
        // reloads charts with Treatment data
        iobcobChart.setColumnChartData(extendedGraphBuilder.iobcobFutureChart(statList));
        try {
          reply.put("iob", String.format(Locale.ENGLISH, "%.2f", statList.get(0).iob));
          reply.put("cob", String.format(Locale.ENGLISH, "%.2f", statList.get(0).cob));
        } catch (JSONException e) {
          Crashlytics.logException(e);
          e.printStackTrace();
        }
        return reply;
      } else {
        try {
          reply.put("iob", String.format(Locale.ENGLISH, "%.2f", 0.00));
          reply.put("cob", String.format(Locale.ENGLISH, "%.2f", 0.00));
        } catch (JSONException e) {
          Crashlytics.logException(e);
          e.printStackTrace();
        }
        return reply;
      }
    }
コード例 #10
0
 private void initBuilder(String title, String content) {
   builder = new NotificationCompat.Builder(baseActivity.getBaseContext());
   builder.setContentTitle(title);
   builder.setContentText(content);
   builder.setSmallIcon(R.drawable.ic_lets_go);
   builder.setPriority(NotificationCompat.PRIORITY_MAX);
   builder.setOngoing(true);
 }
コード例 #11
0
 public DataListAdapter(Activity activity, ArrayList<String> itemsList, Uri dbUri) {
   this.mBaseActivity = (DataListActivity) activity;
   mInflater =
       (LayoutInflater)
           activity.getBaseContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
   this.mUuidList = itemsList;
   this.mDbUri = dbUri;
 }
コード例 #12
0
  /**
   * @param act - interrogate prefs to determine if app has ever been run before
   * @return - true if app has been run before
   */
  public static boolean isFirstRun(Activity act) {
    Resources res = act.getResources();
    final String NOT_PRESENT = res.getString(R.string.PREF_NOT_PRESENT);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(act.getBaseContext());

    String tmp = prefs.getString("etpSignIn1", NOT_PRESENT);
    return tmp.equals(NOT_PRESENT);
  }
コード例 #13
0
ファイル: UtilConstants.java プロジェクト: PMTM/UICCTester
  public static String getPostUrl(Activity a) {

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(a.getBaseContext());
    String host = prefs.getString("logServer", "server");

    String link = "http://" + host + "/uicc/post.php";
    return link;
  }
コード例 #14
0
  public void dispatchProxyToPlugin() {

    if (plugin.getBaseContext() != null) return;
    try {
      // Finals 修改以前的注入方式,采用原生的方式
      Instrumentation instrumentation = proxyRef.get("mInstrumentation");
      pluginRef.call(
          // 方法名
          "attach",
          // Context context
          proxy,
          // ActivityThread aThread
          proxyRef.get("mMainThread"),
          // Instrumentation instr
          new LPluginInstrument(instrumentation),
          // IBinder token
          proxyRef.get("mToken"),
          // int ident
          proxyRef.get("mEmbeddedID") == null ? 0 : proxyRef.get("mEmbeddedID"),
          // Application application
          app == null ? proxy.getApplication() : app,
          // Intent intent
          proxy.getIntent(),
          // ActivityInfo info
          proxyRef.get("mActivityInfo"),
          // CharSequence title
          proxy.getTitle(),
          // Activity parent
          proxy.getParent(),
          // String id
          proxyRef.get("mEmbeddedID"),
          // NonConfigurationInstances lastNonConfigurationInstances
          proxy.getLastNonConfigurationInstance(),
          // Configuration config
          proxyRef.get("mCurrentConfig"));

      pluginRef.set("mWindow", proxy.getWindow());
      plugin.getWindow().setCallback(plugin);
      Reflect.on(proxy.getBaseContext()).call("setOuterContext", plugin);

    } catch (ReflectException e) {
      System.out.println("gyb-->" + e);
      e.printStackTrace();
    }
  }
コード例 #15
0
  @Override
  protected void onPostExecute(Integer result) {
    t.interrupt();
    progressBar.dismiss();

    if (result == 200) {
      Toast.makeText(
              activity.getBaseContext(), "You have registered successfully! ", Toast.LENGTH_LONG)
          .show();
    } else {
      Log.d("MyApp", "Register Code is: " + result);
      Toast.makeText(
              activity.getBaseContext(),
              "Registration has failed! " + errordetails,
              Toast.LENGTH_LONG)
          .show();
    }
  }
コード例 #16
0
 public static boolean isLoggedIn(Activity act) {
   SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(act.getBaseContext());
   String username = prefs.getString(act.getString(R.string.prefs_username), "");
   String apiKey = prefs.getString(act.getString(R.string.prefs_api_key), "");
   if (username.trim().equals("") || apiKey.trim().equals("")) {
     return false;
   } else {
     return true;
   }
 }
コード例 #17
0
 /**
  * Construct a RequirementListAdapter.
  *
  * @param task The task for which to list Requirements
  * @param mode The mode ("edit"/"view")
  * @param context The context for which to inflate layouts
  */
 public RequirementListAdapter(Task task, String mode, Activity activity) {
   this.task = task;
   this.mode = mode;
   this.activity = activity;
   observers = new ArrayList<DataSetObserver>();
   inflater = LayoutInflater.from(activity.getBaseContext());
   // Get our initial data
   fIntentFactory = new FulfillmentIntentFactory(activity);
   update();
 }
コード例 #18
0
ファイル: LanguageHelper.java プロジェクト: hmkpa/AppToolsLib
  /** 根据标识 设置选择的语言环境 */
  public static void settingLanguage(Activity indexActivity, Locale locale) {
    //		if (tempNumber == 0) {
    //			// 设置本地语言为中文
    //			locale = Locale.SIMPLIFIED_CHINESE;
    //		} else if (tempNumber == 1) {
    //			// 设置本地语言为英文
    //			locale = Locale.ENGLISH;
    //		} else {
    //			// 设置本地语言为日文
    //			locale = Locale.JAPAN;
    //		}
    if (null == locale || Locale.getDefault().equals(locale)) {
      return;
    }

    Locale.setDefault(locale); // 设置选定的语言
    Configuration config = new Configuration();
    // 更新设置
    config.locale = locale;
    indexActivity
        .getBaseContext()
        .getResources()
        .updateConfiguration(
            config, indexActivity.getBaseContext().getResources().getDisplayMetrics());
    indexActivity.finish();
    // 重启当前界面
    indexActivity.startActivity(indexActivity.getIntent());
    // @toto 为了确保下次进入程序记住当前选择的语言,可以使用SharedPreferences
    // 来记住设置。values-en-rUS values-ja-rJP values-zh-rCN
    //		SharedPreferences sharedPreferences = indexActivity.getSharedPreferences("phantom",
    // Context.MODE_PRIVATE);
    //		sharedPreferences.edit().putString("locale", locale.toString()).commit();
    //		// 设置成功后的提示信息
    //		if (locale == Locale.SIMPLIFIED_CHINESE) {
    //			Toast.makeText(indexActivity, R.string.ab_msg_chinese_setted, 1000).show();
    //		} else if (locale == Locale.ENGLISH) {
    //			Toast.makeText(indexActivity, R.string.ab_msg_english_setted, 1000).show();
    //		} else {
    //			Toast.makeText(indexActivity, R.string.ab_msg_japanese_setted, 1000).show();
    //		}
  }
コード例 #19
0
 @Override
 public void onClick(View v) {
   final SharedPreferences settings = MyApplication.getInstance().getSettings();
   final String securityQuestion = MyApplication.PrefKey.SECURITY_QUESTION.getString("");
   EditText input = (EditText) dialog.findViewById(R.id.password);
   TextView error = (TextView) dialog.findViewById(R.id.passwordInvalid);
   if (v == dialog.getButton(AlertDialog.BUTTON_NEGATIVE)) {
     if ((Boolean) input.getTag()) {
       input.setTag(Boolean.valueOf(false));
       ((Button) v).setText(R.string.password_lost);
       dialog.setTitle(R.string.password_prompt);
     } else {
       input.setTag(Boolean.valueOf(true));
       dialog.setTitle(securityQuestion);
       ((Button) v).setText(android.R.string.cancel);
     }
   } else {
     String value = input.getText().toString();
     boolean isInSecurityQuestion = (Boolean) input.getTag();
     if (Utils.md5(value)
         .equals(
             (isInSecurityQuestion
                     ? MyApplication.PrefKey.SECURITY_ANSWER
                     : MyApplication.PrefKey.SET_PASSWORD)
                 .getString(""))) {
       input.setText("");
       error.setText("");
       MyApplication.getInstance().setLocked(false);
       ctx.findViewById(android.R.id.content).setVisibility(View.VISIBLE);
       if (ctx instanceof ActionBarActivity) {
         ((ActionBarActivity) ctx).getSupportActionBar().show();
       }
       if (isInSecurityQuestion) {
         MyApplication.PrefKey.PERFORM_PROTECTION.putBoolean(false);
         Toast.makeText(
                 ctx.getBaseContext(), R.string.password_disabled_reenable, Toast.LENGTH_LONG)
             .show();
         dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setText(R.string.password_lost);
         dialog.setTitle(R.string.password_prompt);
         input.setTag(Boolean.valueOf(false));
       }
       dialog.dismiss();
     } else {
       input.setText("");
       error.setText(
           isInSecurityQuestion
               ? R.string.password_security_answer_not_valid
               : R.string.password_not_valid);
     }
   }
 }
コード例 #20
0
  public void ChangeParams(
      String login, String password, Activity activity, OnComplete onComplete) {
    boolean status = GetStatus();
    if (login.isEmpty() || password.isEmpty()) {
      onComplete.Error(activity.getBaseContext().getString(R.string.error_empty_field));
    } else {
      options.setParams(login, password);

      if (status) {
        options.setNotificationId("");
        onComplete.Complete();
      } else {
        pushNotification.register(
            activity, Options.SENDER_ID, options.getNotificationId(), onComplete);
      }
    }
  }
  public void uncaughtException(Thread thread, Throwable exception) {
    StringWriter stackTrace = new StringWriter();
    exception.printStackTrace(new PrintWriter(stackTrace));
    StringBuilder errorReport = new StringBuilder();
    errorReport.append("************ CAUSE OF ERROR ************\n\n");
    errorReport.append(stackTrace.toString());

    errorReport.append("\n************ DEVICE INFORMATION ***********\n");
    errorReport.append("Brand: ");
    errorReport.append(Build.BRAND);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("Device: ");
    errorReport.append(Build.DEVICE);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("Model: ");
    errorReport.append(Build.MODEL);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("Id: ");
    errorReport.append(Build.ID);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("Product: ");
    errorReport.append(Build.PRODUCT);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("\n************ FIRMWARE ************\n");
    errorReport.append("SDK: ");
    errorReport.append(Build.VERSION.SDK);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("Release: ");
    errorReport.append(Build.VERSION.RELEASE);
    errorReport.append(LINE_SEPARATOR);
    errorReport.append("Incremental: ");
    errorReport.append(Build.VERSION.INCREMENTAL);
    errorReport.append(LINE_SEPARATOR);

    Intent intent = new Intent(activity.getBaseContext(), CrashActivity.class);
    intent.putExtra("error", errorReport.toString());
    activity.startActivityForResult(intent, ActivityOperationResult.Crash.toInt());

    android.os.Process.killProcess(android.os.Process.myPid());
    System.exit(10);
  }
コード例 #22
0
      @Override
      protected Bitmap doInBackground(YouRoomEntry... params) {

        YouRoomCommandProxy proxy = new YouRoomCommandProxy(activity);
        Bitmap image = null;
        roomEntry = params[0];
        String roomId = roomEntry.getRoomId();
        String participationId = roomEntry.getParticipationId();
        synchronized (activity.getBaseContext()) {
          try {
            image = proxy.getMemberImageFromCache(roomId, participationId);
            if (image == null) {
              image = proxy.getMemberImage(roomId, participationId, errFlg);
            }
            roomEntry.setMemberImage(image);
          } catch (Exception e) {
            e.printStackTrace();
            errFlg[0] = true;
            image = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
          }
          return image;
        }
      }
コード例 #23
0
 public static void start(Activity a) {
   Intent i = new Intent(a.getBaseContext(), HomeActivity.class);
   i.putExtra(SHOW_CONTENT_KEY, false);
   a.startActivity(i);
 }
コード例 #24
0
  public void updateCustomerInformation() {

    latitude = txtlat.getText().toString();
    longitude = txtlong.getText().toString();
    if (latitude.equalsIgnoreCase("")
        || longitude.equalsIgnoreCase("")
        || edtContactname.getText().toString().equalsIgnoreCase("")
        || edtCompany.getText().toString().equalsIgnoreCase("")
        || edtAddress.getText().toString().equalsIgnoreCase("")
        || edtFarmName.getText().toString().equalsIgnoreCase("")
        || edtFarmId.getText().toString().equalsIgnoreCase("")
        || edtContactNumber.getText().toString().equalsIgnoreCase("")
        || edtCultureSystem.getText().toString().equalsIgnoreCase("")
        || edtLevelOfCulture.getText().toString().equalsIgnoreCase("")
        || edtWaterType.getText().toString().equalsIgnoreCase("")) {
      Helper.toastShort(activity, Helper.variables.URL_DELETE_CUSTINFO_BY_ID);

    } else {
      PD.show();
      PD.setMessage("Saving changes...");

      if (Helper.variables.getGlobalVar_currentLevel(activity) != 4) {
        StringRequest postRequest =
            new StringRequest(
                Request.Method.POST,
                Helper.variables.URL_UPDATE_CUSTOMERINFORMATION_BY_ID,
                new Response.Listener<String>() {
                  @Override
                  public void onResponse(String response) {

                    if (!Helper.extractResponseCodeBySplit(response).equalsIgnoreCase("0")) {
                      PD.dismiss();
                      Helper.toastShort(activity, "Update successful.");
                      Logging.loguserAction(
                          activity,
                          context,
                          Helper.userActions.TSR.Edit_FARM + ": index " + farmIndexId,
                          Helper.variables.ACTIVITY_LOG_TYPE_TSR_MONITORING);
                    } else {
                      PD.dismiss();
                      Helper.toastShort(
                          activity, getResources().getString(R.string.VolleyUnexpectedError));
                    }
                  }
                },
                new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                    PD.dismiss();
                    Helper.toastShort(activity, "Failed to connect to server.");
                  }
                }) {
              @Override
              protected Map<String, String> getParams() {
                Map<String, String> params = new HashMap<String, String>();
                params.put("id", farmIndexId + "");
                params.put("latitude", String.valueOf(txtlat.getText()));
                params.put("longitude", String.valueOf(txtlong.getText()));
                params.put("contactName", edtContactname.getText().toString());
                params.put("company", edtCompany.getText().toString());
                params.put("address", edtAddress.getText().toString());
                params.put("farmName", edtFarmName.getText().toString());
                params.put("farmID", edtFarmId.getText().toString());
                params.put("contactNumber", edtContactNumber.getText().toString());
                params.put("cultureType", edtCultureSystem.getText().toString());
                params.put("cultureLevel", edtLevelOfCulture.getText().toString());
                params.put("waterType", edtWaterType.getText().toString());
                params.put("username", Helper.variables.getGlobalVar_currentUserName(activity));
                params.put("password", Helper.variables.getGlobalVar_currentUserPassword(activity));
                params.put("deviceid", Helper.getMacAddress(activity));

                return params;
              }
            };

        // Adding request to request queue
        MyVolleyAPI api = new MyVolleyAPI();
        api.addToReqQueue(postRequest, Activity_FarmInfo_Edit.this);
      } else {

        db.open();
        int rowsAffectedCount =
            db.updateRowFarmInfo(
                farmIndexId + "",
                edtContactname.getText() + "",
                edtCompany.getText() + "",
                edtAddress.getText() + "",
                edtFarmName.getText() + "",
                edtFarmId.getText() + "",
                edtContactNumber.getText() + "",
                edtCultureSystem.getText() + "",
                edtLevelOfCulture.getText() + "",
                edtWaterType.getText() + "");

        if (rowsAffectedCount > 0) {
          PD.dismiss();
          Helper.createCustomThemedDialogOKOnly(
              activity, "Success", "Changes was successfully saved.", "OK", R.color.blue);
          Intent intent = new Intent(activity, MapsActivity.class);
          intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
          intent.putExtra("fromActivity", "addfarminfo");

          Logging.loguserAction(
              activity,
              activity.getBaseContext(),
              Helper.userActions.TSR.Edit_FARM
                  + ":"
                  + Helper.variables.getGlobalVar_currentUserID(activity)
                  + "-"
                  + farmIndexId
                  + "-"
                  + edtFarmName.getText().toString(),
              Helper.variables.ACTIVITY_LOG_TYPE_TSR_MONITORING);

          startActivity(intent);
          finish(); // call this to finish the current activity
        } else {
          Helper.createCustomThemedDialogOKOnly(
              activity, "Error", "Something happened. Please try again.", "OK", R.color.red);
        }
      }
    }
  }
コード例 #25
0
 public static <T extends Activity> void goToActivity(
     Activity activity, ActivityOperationResult type, Class<T> _class) {
   activity.startActivityForResult(new Intent(activity.getBaseContext(), _class), type.toInt());
 }
コード例 #26
0
ファイル: MBParams.java プロジェクト: NilDarvin/MBLib
 // Возвращает имя ресурса параметров
 public String getResName() {
   return act.getBaseContext().toString();
 }
コード例 #27
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   mContext = activity.getBaseContext();
 }