List of usage examples for android.widget TextView append
public final void append(CharSequence text)
From source file:com.example.com.benasque2014.mercurio.FamiliaMapaFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.action_details) { Dialog d = new Dialog(getActivity()); d.setTitle("Detalles del trayecto"); d.setContentView(R.layout.dialog_details); TextView text = (TextView) d.findViewById(R.id.text); text.setText(""); text.append("Nombre: " + recorrido.getName() + "\n"); text.append("Cdigo: " + recorrido.getCodigo() + "\n"); text.append("Clase: " + recorrido.getClase() + "\n"); text.append("Hora inicio: " + recorrido.getHoraInicio() + "\n"); text.append("Hora fin: " + recorrido.getHoraFin() + "\n"); text.append("Frecuencia: " + recorrido.getFrecuencia() + "\n"); text.append("Incidencia: " + recorrido.getIncidencia() + "\n"); d.show();// ww w. j av a 2 s . c o m } return super.onOptionsItemSelected(item); }
From source file:com.levien.audiobuffersize.AudioBufferSize.java
synchronized void log(String text) { msgLog += text + "\n"; final TextView tv = (TextView) findViewById(R.id.textView1); //tv.setText(msgLog); tv.append(text + "\n"); final ScrollView sv = (ScrollView) findViewById(R.id.scrollView); sv.fullScroll(View.FOCUS_DOWN); }
From source file:eu.fistar.sdcs.pa.MainActivity.java
private void updateLog(String log) { Log.d(LOGTAG, log);//from www . j a v a 2 s . com final String fLog = log; final TextView tv = (TextView) findViewById(R.id.logBox); tv.post(new Runnable() { @Override public void run() { tv.append(fLog + "\n"); } }); final ScrollView sv = (ScrollView) findViewById(R.id.scrollBox); sv.postDelayed(new Runnable() { @Override public void run() { sv.fullScroll(ScrollView.FOCUS_DOWN); } }, 100L); }
From source file:com.gsbabil.antitaintdroid.UtilityFunctions.java
public void statusUpdate(String msg) { TextView tv = (TextView) MyApp.context.findViewById(R.id.textview); tv.append(msg); try {// w w w .ja v a 2 s . c o m int lineTop = 0; try { lineTop = tv.getLayout().getLineTop(tv.getLineCount()); } catch (Throwable e) { lineTop = 0; } final int scrollAmount = lineTop - tv.getHeight(); if (scrollAmount > 0) { tv.scrollTo(0, scrollAmount); } else { tv.scrollTo(0, 0); } } catch (Throwable e) { Log.i(MyApp.TAG, e.getMessage().toString()); } }
From source file:com.example.android.wizardpager.wizard.ui.CustomerAddressFragment.java
public void OCR() { String address1;//from w w w.j a v a 2 s. co m String address2; String address3; TextView address1Txt = mAddress1View; TextView address2Txt = mAddress2View; TextView address3Txt = mAddress3View; TextView address4Txt = mAddress4View; String address4 = "Ireland"; mPage.getData().putString(CustomerAddressPage.ADDRESS4_DATA_KEY, address4); address4Txt.append(address4); //String Surname = CustomerInfoPage.SURNAME_DATA_KEY; String proofOfAddressType; //mPage.getData().putString(CustomerAddressPage.ADDRESS1_DATA_KEY, address1); //mPage.getData().putString(CustomerAddressPage.ADDRESS2_DATA_KEY, address2); //mPage.getData().putString(CustomerAddressPage.ADDRESS3_DATA_KEY, address3); //mPage.getData().putString(CustomerAddressPage.ADDRESS4_DATA_KEY, address4); String text = null; try { text = readFile("/sdcard/POAresult.txt"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String salutation = "Mr"; //Drivers license check, if it contains an issued on if (text.contains(salutation)) { //address2Txt.append(salutation); String word = salutation; //String last = "County"; String carriageReturn = "\n"; int startIndex = 0; int endIndex = 0; int endPoint = 0; endPoint = text.indexOf(word); text = text.substring(endPoint, text.length()); for (int i = text.length(); (i = text.lastIndexOf(word, i - 1)) != -1;) { startIndex = i; } for (int i = text.length(); (i = text.lastIndexOf(carriageReturn, i - 1)) != -1;) { endIndex = i; } //int index = text.lastIndexOf(last); //endIndex = index; address1 = text.substring(startIndex, endIndex); mPage.getData().putString(CustomerAddressPage.ADDRESS1_DATA_KEY, address1); address1Txt.append(address1); //start from the end of the last occurance //startIndex = endIndex; //address2 = text.substring(startIndex, endIndex); //int startPoint = address1.length(); //startPoint = text.indexOf(address1 + startPoint); //startPoint = startPoint + 1; text = text.substring(endIndex, text.length()); String county = "County"; startIndex = 0; for (int i = text.length(); (i = text.lastIndexOf(county, i - 1)) != -1;) { endIndex = i; } address2 = text.substring(startIndex, endIndex); //remove carriage returns from the end of string address2 = address2.substring(1, address2.length() - 1); mPage.getData().putString(CustomerAddressPage.ADDRESS2_DATA_KEY, address2); address2Txt.append(address2); //last part text = text.substring(endIndex, text.length()); //int endAddress = text.lastIndexOf(carriageReturn); int endAddress = 0; for (int i = text.length(); (i = text.lastIndexOf(carriageReturn, i - 1)) != -1;) { endAddress = i; } address3 = text.substring(startIndex, endAddress); mPage.getData().putString(CustomerAddressPage.ADDRESS3_DATA_KEY, address3); address3Txt.append(address3); } }
From source file:com.gh4a.fragment.UserFragment.java
private void fillData() { ImageView gravatar = (ImageView) mContentView.findViewById(R.id.iv_gravatar); AvatarHandler.assignAvatar(gravatar, mUser); TextView tvFollowersCount = (TextView) mContentView.findViewById(R.id.tv_followers_count); tvFollowersCount.setText(String.valueOf(mUser.getFollowers())); View llOrgMembers = mContentView.findViewById(R.id.cell_org_members); View llFollowers = mContentView.findViewById(R.id.cell_followers); if (Constants.User.TYPE_USER.equals(mUser.getType())) { llFollowers.setOnClickListener(this); llOrgMembers.setVisibility(View.GONE); } else {/*w w w . ja v a 2s .co m*/ llOrgMembers.setOnClickListener(this); llFollowers.setVisibility(View.GONE); } mContentView.findViewById(R.id.cell_repos).setOnClickListener(this); TextView tvReposCount = (TextView) mContentView.findViewById(R.id.tv_repos_count); if (ApiHelpers.loginEquals(mUserLogin, Gh4Application.get().getAuthLogin())) { tvReposCount.setText(String.valueOf(mUser.getTotalPrivateRepos() + mUser.getPublicRepos())); } else { tvReposCount.setText(String.valueOf(mUser.getPublicRepos())); } //hide gists repos if organization fillCountIfUser(R.id.cell_gists, R.id.tv_gists_count, mUser.getPublicGists() + mUser.getPrivateGists()); //hide following if organization fillCountIfUser(R.id.cell_following, R.id.tv_following_count, mUser.getFollowing()); TextView tvName = (TextView) mContentView.findViewById(R.id.tv_name); tvName.setText(StringUtils.isBlank(mUser.getName()) ? mUser.getLogin() : mUser.getName()); if (Constants.User.TYPE_ORG.equals(mUser.getType())) { tvName.append(" ("); tvName.append(Constants.User.TYPE_ORG); // FIXME tvName.append(")"); } TextView tvCreated = (TextView) mContentView.findViewById(R.id.tv_created_at); if (mUser.getCreatedAt() != null) { tvCreated.setText(getString(R.string.user_created_at, DateFormat.getMediumDateFormat(getActivity()).format(mUser.getCreatedAt()))); tvCreated.setVisibility(View.VISIBLE); } else { tvCreated.setVisibility(View.GONE); } fillTextView(R.id.tv_email, mUser.getEmail()); fillTextView(R.id.tv_website, mUser.getBlog()); fillTextView(R.id.tv_company, mUser.getCompany()); fillTextView(R.id.tv_location, mUser.getLocation()); getLoaderManager().initLoader(1, null, mRepoListCallback); getLoaderManager().initLoader(2, null, mOrganizationCallback); }
From source file:io.github.hidroh.materialistic.ItemActivity.java
@SuppressWarnings("ConstantConditions") private void bindData(@Nullable final WebItem story) { if (story == null) { return;//w ww. j a v a2s. com } mCustomTabsDelegate.mayLaunchUrl(Uri.parse(story.getUrl()), null, null); bindFavorite(); mSessionManager.view(this, story.getId()); mVoteButton.setVisibility(View.VISIBLE); mVoteButton.setOnClickListener(v -> vote(story)); final TextView titleTextView = (TextView) findViewById(android.R.id.text2); if (story.isStoryType()) { titleTextView.setText(story.getDisplayedTitle()); setTaskTitle(story.getDisplayedTitle()); if (!TextUtils.isEmpty(story.getSource())) { TextView sourceTextView = (TextView) findViewById(R.id.source); sourceTextView.setText(story.getSource()); sourceTextView.setVisibility(View.VISIBLE); } } else { CharSequence title = AppUtils.fromHtml(story.getDisplayedTitle()); titleTextView.setText(title); setTaskTitle(title); } final TextView postedTextView = (TextView) findViewById(R.id.posted); postedTextView.setText(story.getDisplayedTime(this)); postedTextView.append(story.getDisplayedAuthor(this, true, 0)); postedTextView.setMovementMethod(LinkMovementMethod.getInstance()); switch (story.getType()) { case Item.JOB_TYPE: postedTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_work_white_18dp, 0, 0, 0); break; case Item.POLL_TYPE: postedTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_poll_white_18dp, 0, 0, 0); break; } mAdapter = new ItemPagerAdapter(this, getSupportFragmentManager(), new ItemPagerAdapter.Builder().setItem(story).setShowArticle(!mExternalBrowser) .setCacheMode(getIntent().getIntExtra(EXTRA_CACHE_MODE, ItemManager.MODE_DEFAULT)) .setDefaultViewMode(mStoryViewMode)); mAdapter.bind(mViewPager, mTabLayout, mNavButton, mReplyButton); mTabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager) { @Override public void onTabReselected(TabLayout.Tab tab) { mAppBar.setExpanded(true, true); } }); if (story.isStoryType() && mExternalBrowser) { findViewById(R.id.header_card_view) .setOnClickListener(v -> AppUtils.openWebUrlExternal(ItemActivity.this, story, story.getUrl(), mCustomTabsDelegate.getSession())); } else { findViewById(R.id.header_card_view).setClickable(false); } if (mFullscreen) { setFullscreen(); } }
From source file:color.kidpaint.com.kidpaintcolor.dialog.DialogTermsOfUseAndService.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//from www . ja v a 2s .c om public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity()); builder.setTitle(R.string.terms_of_use_and_service_title); View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null); TextView termsOfUseAndServiceTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Text); termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content); TextView termsOfUseAndServiceUrlTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Url); termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getActivity().getResources(); String paintroidTermsOfUseAndService = String.format( resources.getString(R.string.terms_of_use_and_service_link_template), resources.getString(R.string.terms_of_use_and_service_url), resources.getString(R.string.terms_of_use_and_service_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService)); termsOfUseAndServiceUrlTextView.append("\n\n"); String aboutCatroid = String.format(resources.getString(R.string.about_link_template), resources.getString(R.string.catroid_url), resources.getString(R.string.about_catroid_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid)); termsOfUseAndServiceUrlTextView.append("\n"); builder.setView(view); builder.setNeutralButton(R.string.done, this); return builder.create(); }
From source file:com.color.kid.kidpaint.dialog.DialogTermsOfUseAndService.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//w ww. j ava 2 s.c om public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity()); builder.setTitle(R.string.terms_of_use_and_service_title); View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null); TextView termsOfUseAndServiceTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Text); termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content); TextView termsOfUseAndServiceUrlTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Url); termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getActivity().getResources(); String paintroidTermsOfUseAndService = String.format( resources.getString(R.string.terms_of_use_and_service_link_template), resources.getString(R.string.terms_of_use_and_service_url), resources.getString(R.string.terms_of_use_and_service_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService)); termsOfUseAndServiceUrlTextView.append("\n\n"); String aboutCatroid = String.format( /*resources.getString(R.string.about_link_template), resources.getString(R.string.catroid_url),*/ resources.getString(R.string.about_catroid_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid)); termsOfUseAndServiceUrlTextView.append("\n"); builder.setView(view); builder.setNeutralButton(R.string.done, this); return builder.create(); }
From source file:fi.loezi.unifud.MainActivity.java
public void showAboutDialog() { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_fragment); dialog.setTitle("UniFud"); final TextView text = (TextView) dialog.findViewById(R.id.dialogText); text.setText(// ww w.j a v a2s . c o m "Created by Leo Leppnen (leo.leppanen@helsinki.fi)\n" + "\n" + "Data provided by HYY Ravintolat\n" + "\n" + "Icons by Freepik and Icon Works from www.flaticon.com, licensed under CC BY 3.0"); String version = null; try { version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException exception) { version = "unknown"; } text.append("\n\nVersion " + version); final Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); dialogButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }