List of usage examples for java.lang CharSequence toString
public String toString();
From source file:launcher.net.CustomIOUtils.java
/** * Convert the specified CharSequence to an input stream, encoded as bytes * using the specified character encoding. * * @param input the CharSequence to convert * @param encoding the encoding to use, null means platform default * @return an input stream/*from ww w . j a v a2 s . com*/ * @since 2.3 */ public static InputStream toInputStream(CharSequence input, Charset encoding) { return toInputStream(input.toString(), encoding); }
From source file:jef.tools.StringUtils.java
/** * HTML/*from ww w . j a v a2s. c o m*/ */ public static CharSequence escapeHtml(CharSequence s, boolean unicode) { if (unicode) return StringEscapeUtils.escapeHtml(s.toString()); StringBuilder sb = new StringBuilder(s.length() + 16); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); int n = htmlEscEntities.indexOf(c); if (n > -1) { sb.append(htmlEscapeSequence[n]); } else { sb.append(c); } } return sb.length() == s.length() ? s : sb.toString();// ??string? }
From source file:com.edible.ocr.CaptureActivity.java
/** * Given either a Spannable String or a regular String and a token, apply * the given CharacterStyle to the span between the tokens. * /* w w w .j a va 2 s .c o m*/ * NOTE: This method was adapted from: * http://www.androidengineer.com/2010/08/easy-method-for-formatting-android.html * * <p> * For example, {@code setSpanBetweenTokens("Hello ##world##!", "##", new * ForegroundColorSpan(0xFFFF0000));} will return a CharSequence {@code * "Hello world!"} with {@code world} in red. * */ private CharSequence setSpanBetweenTokens(CharSequence text, String token, CharacterStyle... cs) { // Start and end refer to the points where the span will apply int tokenLen = token.length(); int start = text.toString().indexOf(token) + tokenLen; int end = text.toString().indexOf(token, start); if (start > -1 && end > -1) { // Copy the spannable string to a mutable spannable string SpannableStringBuilder ssb = new SpannableStringBuilder(text); for (CharacterStyle c : cs) ssb.setSpan(c, start, end, 0); text = ssb; } return text; }
From source file:com.roamprocess1.roaming4world.ui.messages.MessageActivity.java
@Override protected void onStart() { super.onStart(); try {//w ww .ja va2 s.co m bodyInput.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub typingcall(); String msg = s.toString().trim(); if (isMultiMediaMsg(msg)) { bodyInput.getText().clear(); Intent intent = new Intent(MessageActivity.this, MessageCopyHandler.class); intent.putExtra("message", msg); intent.putExtra("user_number", stripNumber(prefs.getString(stored_chatuserNumber, ""))); startActivity(intent); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); } catch (Exception e) { // TODO: handle exception } }
From source file:launcher.net.CustomIOUtils.java
/** * Writes chars from a <code>CharSequence</code> to bytes on an * <code>OutputStream</code> using the specified character encoding. * <p>/* www .j a v a2 s .c om*/ * This method uses {@link String#getBytes(String)}. * * @param data the <code>CharSequence</code> to write, null ignored * @param output the <code>OutputStream</code> to write to * @param encoding the encoding to use, null means platform default * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since 2.3 */ public static void write(CharSequence data, OutputStream output, Charset encoding) throws IOException { if (data != null) { write(data.toString(), output, encoding); } }
From source file:com.ximai.savingsmore.save.activity.AddGoodsAcitivyt.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_good_activity); setCenterTitle("?"); setLeftBackMenuVisibility(AddGoodsAcitivyt.this, ""); head_view = (ImageView) findViewById(R.id.head_image); my_name = (TextView) findViewById(R.id.name); MyImageLoader.displayDefaultImage(URLText.img_url + MyUserInfoUtils.getInstance().myUserInfo.PhotoPath, head_view);/* ww w .j a v a2s .c o m*/ if (null != MyUserInfoUtils.getInstance().myUserInfo.UserExtInfo) { my_name.setText(MyUserInfoUtils.getInstance().myUserInfo.UserExtInfo.StoreName); } cuxiaoshuoming = (TextView) findViewById(R.id.cuxiaoshuoming); shangpingmiaoshu = (TextView) findViewById(R.id.shangpingmiaoshu); horizontalListView = (HorizontalListView) findViewById(R.id.myGridview); yijifenlei = (TextView) findViewById(R.id.one_classity); erjifenlei = (TextView) findViewById(R.id.two_classity); brand = (TextView) findViewById(R.id.brand_name); xingshi_item = (LinearLayout) findViewById(R.id.xingshi_item); xingshi = (TextView) findViewById(R.id.xingshi); yuanyin_item = (LinearLayout) findViewById(R.id.yuanyin_item); yuanyin = (TextView) findViewById(R.id.yuanyin); dizhi_item = (LinearLayout) findViewById(R.id.dizhi_item); dizhi = (TextView) findViewById(R.id.dizhi); satrt_item = (LinearLayout) findViewById(R.id.start_time_item); start = (TextView) findViewById(R.id.start_time); end_item = (LinearLayout) findViewById(R.id.end_time_item); end = (TextView) findViewById(R.id.end_time); danwei_item = (LinearLayout) findViewById(R.id.danwei_item); danwei = (TextView) findViewById(R.id.danwei); bizhong_item = (LinearLayout) findViewById(R.id.bizhong_item); bizhong = (TextView) findViewById(R.id.bizhong); fapiao_item = (LinearLayout) findViewById(R.id.fapiao_item); fapiao = (TextView) findViewById(R.id.fapiao); yuan_price = (EditText) findViewById(R.id.yuan_price); cuxiao_price = (EditText) findViewById(R.id.cuxiao_price); cuxiao_text = (TextView) findViewById(R.id.cuxiao_text); fabu = (TextView) findViewById(R.id.fabu); product_bianhao = (EditText) findViewById(R.id.product_bianhao); product_name = (EditText) findViewById(R.id.product_name); xiangxi_address = (EditText) findViewById(R.id.xiangxi_address); servise = (TextView) findViewById(R.id.servise); servise.setOnClickListener(this); fabu.setOnClickListener(this); yijifenlei.setOnClickListener(this); erjifenlei.setOnClickListener(this); brand.setOnClickListener(this); xingshi_item.setOnClickListener(this); yuanyin_item.setOnClickListener(this); dizhi_item.setOnClickListener(this); satrt_item.setOnClickListener(this); end_item.setOnClickListener(this); danwei_item.setOnClickListener(this); bizhong_item.setOnClickListener(this); fapiao_item.setOnClickListener(this); yuan_price.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (null != xingshi_id) { if (xingshi_id.equals("2") || xingshi_id.equals("3") || xingshi_id.equals("7") || xingshi_id.equals("12")) { cuxiao_price.setText(s.toString()); } } } }); myAdapter = new MyAdapter(); horizontalListView.setAdapter(myAdapter); queryDicNode(); queryDicNode2(); explain = (EditText) findViewById(R.id.explain); descript = (EditText) findViewById(R.id.decript); shuoming_number = explain.getText().length(); miaoshu_number = descript.getText().length(); explain.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { shuoming_number = explain.getText().length(); cuxiaoshuoming.setText("(?" + (200 - shuoming_number) + ")"); } @Override public void afterTextChanged(Editable s) { } }); descript.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { miaoshu_number = descript.getText().length(); shangpingmiaoshu.setText("???(?" + (200 - miaoshu_number) + ")"); } @Override public void afterTextChanged(Editable s) { } }); zidingyi_brand = (TextView) findViewById(R.id.zidingyi_brand); custom_type = (TextView) findViewById(R.id.custom_type); zidingyi_brand.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { classity_dialog = new AlertDialog.Builder(AddGoodsAcitivyt.this).create(); View view = LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.save_brand, null); final TextView queding, quxiao; final EditText content; queding = (TextView) view.findViewById(R.id.comfirm); quxiao = (TextView) view.findViewById(R.id.cannel); content = (EditText) view.findViewById(R.id.content); queding.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != content.getText() && !TextUtils.isEmpty(content.getText())) { save_brand(content.getText().toString()); } } }); quxiao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { classity_dialog.dismiss(); } }); classity_dialog.setView(view); classity_dialog.show(); } }); custom_type.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (oneId != null && !TextUtils.isEmpty(oneId)) { brand_dialog = new AlertDialog.Builder(AddGoodsAcitivyt.this).create(); View view = LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.custom_classfy, null); final TextView queding, quxiao; final EditText content; queding = (TextView) view.findViewById(R.id.comfirm); quxiao = (TextView) view.findViewById(R.id.cannel); content = (EditText) view.findViewById(R.id.content); queding.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != content.getText() && !TextUtils.isEmpty(content.getText())) { apply_calssity(content.getText().toString(), oneId); } } }); quxiao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { brand_dialog.dismiss(); } }); brand_dialog.setView(view); brand_dialog.show(); } else { Toast.makeText(AddGoodsAcitivyt.this, "", Toast.LENGTH_SHORT).show(); } } }); cuxiao_price.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (cuxiao_text.getText().equals("N?N")) { bug_dialog = new AlertDialog.Builder(AddGoodsAcitivyt.this).create(); View view = LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.bug_give, null); final TextView queding, quxiao; final EditText number1, number2; queding = (TextView) view.findViewById(R.id.comfirm); quxiao = (TextView) view.findViewById(R.id.cannel); number1 = (EditText) view.findViewById(R.id.number1); number2 = (EditText) view.findViewById(R.id.number2); queding.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != number1.getText() && !TextUtils.isEmpty(number1.getText()) && null != number2.getText() && !TextUtils.isEmpty(number2.getText())) { cuxiao_price.setText("" + number1.getText().toString() + "?" + number2.getText().toString()); bug_dialog.dismiss(); } } }); quxiao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bug_dialog.dismiss(); } }); bug_dialog.setView(view); bug_dialog.show(); } } }); myProduct = new MyProduct(); if (null != getIntent().getStringExtra("id")) { Id = getIntent().getStringExtra("id"); getgood_detial(Id); } }
From source file:com.ccxt.whl.activity.ChatActivity.java
/** * ?gridview?view/* ww w .j a v a2s . c om*/ * * @param i * @return */ private View getGridChildView(int i) { View view = View.inflate(this, R.layout.expression_gridview, null); ExpandGridView gv = (ExpandGridView) view.findViewById(R.id.gridview); List<String> list = new ArrayList<String>(); if (i == 1) { List<String> list1 = reslist.subList(0, 20); list.addAll(list1); } else if (i == 2) { list.addAll(reslist.subList(20, reslist.size())); } list.add("delete_expression"); final ExpressionAdapter expressionAdapter = new ExpressionAdapter(this, 1, list); gv.setAdapter(expressionAdapter); gv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String filename = expressionAdapter.getItem(position); try { // ???? // ????? if (buttonSetModeKeyboard.getVisibility() != View.VISIBLE) { if (filename != "delete_expression") { // ? // ????SmileUtils Class clz = Class.forName("com.ccxt.whl.utils.SmileUtils"); Field field = clz.getField(filename); mEditTextContent .append(SmileUtils.getSmiledText(ChatActivity.this, (String) field.get(null))); } else { // if (!TextUtils.isEmpty(mEditTextContent.getText())) { int selectionStart = mEditTextContent.getSelectionStart();// ?? if (selectionStart > 0) { String body = mEditTextContent.getText().toString(); String tempStr = body.substring(0, selectionStart); int i = tempStr.lastIndexOf("[");// ??? if (i != -1) { CharSequence cs = tempStr.substring(i, selectionStart); if (SmileUtils.containsKey(cs.toString())) mEditTextContent.getEditableText().delete(i, selectionStart); else mEditTextContent.getEditableText().delete(selectionStart - 1, selectionStart); } else { mEditTextContent.getEditableText().delete(selectionStart - 1, selectionStart); } } } } } } catch (Exception e) { } } }); return view; }
From source file:com.servoy.j2db.util.Utils.java
/** * Checks whether the <code>string</code> is considered empty. Empty means that the string may contain whitespace, but no visible characters. * * "\n\t " is considered empty, while " a" is not. * * @param str the string//from w ww . j a va 2 s. c o m * @return true if the string is null or "" */ public static boolean stringIsEmpty(final CharSequence str) { return str == null || str.length() == 0 || str.toString().trim().length() == 0; }
From source file:com.cyberway.issue.crawler.extractor.ExtractorHTML.java
protected void processGeneralTag(CrawlURI curi, CharSequence element, CharSequence cs) { Matcher attr = TextUtils.getMatcher(EACH_ATTRIBUTE_EXTRACTOR, cs); // Just in case it's an OBJECT or APPLET tag String codebase = null;/* w ww .j a v a 2 s .c o m*/ ArrayList<String> resources = null; // Just in case it's a FORM CharSequence action = null; CharSequence actionContext = null; CharSequence method = null; final boolean framesAsEmbeds = ((Boolean) getUncheckedAttribute(curi, ATTR_TREAT_FRAMES_AS_EMBED_LINKS)) .booleanValue(); final boolean ignoreFormActions = ((Boolean) getUncheckedAttribute(curi, ATTR_IGNORE_FORM_ACTION_URLS)) .booleanValue(); final boolean extractValueAttributes = ((Boolean) getUncheckedAttribute(curi, EXTRACT_VALUE_ATTRIBUTES)) .booleanValue(); final String elementStr = element.toString(); while (attr.find()) { int valueGroup = (attr.start(14) > -1) ? 14 : (attr.start(15) > -1) ? 15 : 16; int start = attr.start(valueGroup); int end = attr.end(valueGroup); assert start >= 0 : "Start is: " + start + ", " + curi; assert end >= 0 : "End is :" + end + ", " + curi; CharSequence value = cs.subSequence(start, end); value = TextUtils.unescapeHtml(value); if (attr.start(2) > -1) { // HREF CharSequence context = Link.elementContext(element, attr.group(2)); if (elementStr.equalsIgnoreCase(LINK)) { // <LINK> elements treated as embeds (css, ico, etc) processEmbed(curi, value, context); } else { // other HREFs treated as links if (value.toString().indexOf("java") != -1) System.out.println(value + "--------javascript--------"); processLink(curi, value, context); } if (elementStr.equalsIgnoreCase(BASE)) { try { curi.setBaseURI(value.toString()); } catch (URIException e) { if (getController() != null) { // Controller can be null: e.g. when running // ExtractorTool. getController().logUriError(e, curi.getUURI(), value.toString()); } else { logger.info("Failed set base uri: " + curi + ", " + value.toString() + ": " + e.getMessage()); } } } } else if (attr.start(3) > -1) { // ACTION if (!ignoreFormActions) { action = value; actionContext = Link.elementContext(element, attr.group(3)); // handling finished only at end (after METHOD also collected) } } else if (attr.start(4) > -1) { // ON____ processScriptCode(curi, value); // TODO: context? } else if (attr.start(5) > -1) { // SRC etc. CharSequence context = Link.elementContext(element, attr.group(5)); // true, if we expect another HTML page instead of an image etc. final char hopType; if (!framesAsEmbeds && (elementStr.equalsIgnoreCase(FRAME) || elementStr.equalsIgnoreCase(IFRAME))) { hopType = Link.NAVLINK_HOP; } else { hopType = Link.EMBED_HOP; } processEmbed(curi, value, context, hopType); } else if (attr.start(6) > -1) { // CODEBASE codebase = (value instanceof String) ? (String) value : value.toString(); CharSequence context = Link.elementContext(element, attr.group(6)); processEmbed(curi, codebase, context); } else if (attr.start(7) > -1) { // CLASSID, DATA if (resources == null) { resources = new ArrayList<String>(); } resources.add(value.toString()); } else if (attr.start(8) > -1) { // ARCHIVE if (resources == null) { resources = new ArrayList<String>(); } String[] multi = TextUtils.split(WHITESPACE, value); for (int i = 0; i < multi.length; i++) { resources.add(multi[i]); } } else if (attr.start(9) > -1) { // CODE if (resources == null) { resources = new ArrayList<String>(); } // If element is applet and code value does not end with // '.class' then append '.class' to the code value. if (elementStr.equalsIgnoreCase(APPLET) && !value.toString().toLowerCase().endsWith(CLASSEXT)) { resources.add(value.toString() + CLASSEXT); } else { resources.add(value.toString()); } } else if (attr.start(10) > -1) { // VALUE, with possibility of URI if (extractValueAttributes && TextUtils.matches(LIKELY_URI_PATH, value)) { CharSequence context = Link.elementContext(element, attr.group(10)); processLink(curi, value, context); } } else if (attr.start(11) > -1) { // STYLE inline attribute // then, parse for URIs this.numberOfLinksExtracted += ExtractorCSS.processStyleCode(curi, value, getController()); } else if (attr.start(12) > -1) { // METHOD method = value; // form processing finished at end (after ACTION also collected) } else if (attr.start(13) > -1) { // any other attribute // ignore for now // could probe for path- or script-looking strings, but // those should be vanishingly rare in other attributes, // and/or symptomatic of page bugs } } TextUtils.recycleMatcher(attr); // finish handling codebase/resources now that all available if (resources != null) { Iterator iter = resources.iterator(); UURI codebaseURI = null; String res = null; try { if (codebase != null) { // TODO: Pass in the charset. codebaseURI = UURIFactory.getInstance(curi.getUURI(), codebase); } while (iter.hasNext()) { res = iter.next().toString(); res = (String) TextUtils.unescapeHtml(res); if (codebaseURI != null) { res = codebaseURI.resolve(res).toString(); } processEmbed(curi, res, element); // TODO: include attribute too } } catch (URIException e) { curi.addLocalizedError(getName(), e, "BAD CODEBASE " + codebase); } catch (IllegalArgumentException e) { DevUtils.logger.log(Level.WARNING, "processGeneralTag()\n" + "codebase=" + codebase + " res=" + res + "\n" + DevUtils.extraInfo(), e); } } // finish handling form action, now method is available if (action != null) { if (method == null || "GET".equalsIgnoreCase(method.toString()) || !((Boolean) getUncheckedAttribute(curi, ATTR_EXTRACT_ONLY_FORM_GETS)).booleanValue()) { processLink(curi, action, actionContext); } } }
From source file:com.huofu.RestaurantOS.ui.splash.activate.java
/** * ?//from w w w .j ava 2 s . co m */ public void widgetConfigure() { buttonActivate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (authDialog == null) { authDialog = new Dialog(activate.this, R.style.PauseDialog); } if (ttv.getParent() != null) { ttv = new TitanicTextView(ctxt); } String key = etActivteCode.getText().toString(); if (key.length() >= 16) { CommonUtils.LogWuwei(tag, "key is " + key); CommonUtils.sendMsg("?", activate.SHOW_LOADING_TEXT, mUiHandler); activate(ctxt, key); } else { CommonUtils.sendMsg("????", activate.SHOW_ERROR_MESSAGE, mUiHandler); } } }); InputFilter filter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { // TODO Auto-generated method stub for (int i = start; i < end; i++) { //???'-' if (!Character.isLetter(source.charAt(i)) && source.charAt(i) != '-') { return ""; } } return null; } }; InputFilter filterLength = new InputFilter.LengthFilter(19); etActivteCode.setCursorVisible(false); etActivteCode.setFilters(new InputFilter[] { filter, filterLength }); etActivteCode.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub etActivteCode.setCursorVisible(true); etActivteCode.removeTextChangedListener(this);// ? etActivteCode.setText(s.toString().toUpperCase());// ? etActivteCode.setSelection(s.toString().length());// ?? etActivteCode.addTextChangedListener(this);// ? String licensePlateNumber = etActivteCode.getText().toString().trim(); if (s.length() == 19) { InputMethodUtils.HideKeyboard(etActivteCode); } } }); etActivteCode.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_DEL) { CommonUtils.LogWuwei(tag, "delete"); etActivteCode.setCursorVisible(false); } return false; } }); rl_activate_qrscan_ready.setVisibility(View.INVISIBLE); OnClickListener oclGetQrCode = new OnClickListener() { @Override public void onClick(View v) { flagInQrcodeDialog = true; CommonUtils.sendMsg("??", SHOW_LOADING_TEXT, mUiHandler); if (LocalDataDeal.readFromLocalPublicKey(ctxt) == null || LocalDataDeal.readFromLocalPublicKey(ctxt).equals("")) { ApisManager.GetPublicKey(new ApiCallback() { @Override public void success(Object object) { sendUIMessage(HIDE_LOADING, ""); try { org.json.JSONObject obj = new org.json.JSONObject((String) object); String public_key = obj.getString("public_key"); LocalDataDeal.writeToLocalPublicKey(public_key, ctxt);//key?base64? } catch (Exception e) { } CommonUtils.sendMsg("", GET_QRCODE, mUiHandler); } @Override public void error(BaseApi.ApiResponse response) { sendUIMessage(HIDE_LOADING, ""); sendUIMessage(SHOW_ERROR_MESSAGE, response.error_message); } }); } else { CommonUtils.sendMsg("", GET_QRCODE, mUiHandler); } rl_activate_input.setVisibility(View.INVISIBLE); rl_activate_qrscan_ready.setVisibility(View.VISIBLE); imageViewQrcode.setVisibility(View.INVISIBLE); rl_activate_qrscan_ready .startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.small_2_big)); textviewScanStauts.setTextColor(Color.parseColor("#898989")); textviewScanStauts.setText(R.string.activateByQrCodeTips); rl_activate_qrscan_ready .startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.slide_left_in)); rl_activate_input.startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.slide_right_out)); } }; buttonSwitchQrScan.setOnClickListener(oclGetQrCode); findViewById(R.id.rl_switch_activate_qrcode_way).setOnClickListener(oclGetQrCode); buttonSwitchInputCode.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub flagInQrcodeDialog = false; flagWaitingCmd = false; rl_activate_qrscan_ready.setVisibility(View.INVISIBLE); rl_activate_input.setVisibility(View.VISIBLE); rl_activate_input.startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.small_2_big)); stopQrScanTimer(); rl_activate_input.startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.slide_right_in)); rl_activate_qrscan_ready .startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.slide_left_out)); } }); findViewById(R.id.rl_switch_activate_keyboard_way).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub flagInQrcodeDialog = false; flagWaitingCmd = false; rl_activate_qrscan_ready.setVisibility(View.INVISIBLE); rl_activate_input.setVisibility(View.VISIBLE); rl_activate_input.startAnimation(new AnimationUtils().loadAnimation(ctxt, R.anim.small_2_big)); stopQrScanTimer(); } }); PackageManager manager; PackageInfo info = null; manager = this.getPackageManager(); String versionName = null; try { info = manager.getPackageInfo(this.getPackageName(), 0); versionName = info.versionName; } catch (NameNotFoundException e) { e.printStackTrace(); } ((TextView) findViewById(R.id.tv_app_version)) .setText(getResources().getString(R.string.app_name) + " V" + versionName); LocalDataDeal.writeToLocalVersion(versionName, ctxt); LocalDataDeal.writeToLocalVersionCode(info.versionCode, ctxt); ftpServiceStart(); }