List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.bangz.shotrecorder.RecordDetailActivity.java
@Override public void onGetDescription(GetDescriptDialogFragment dialog, String descript) { TextView v = (TextView) findViewById(R.id.txtDescription); String sold = v.getText().toString(); if (sold.equals(descript) == false) { v.setText(descript);//from www . ja v a 2 s .co m mbModified = true; setShareIntent(); } }
From source file:com.aqnote.app.wifianalyzer.about.AboutActivityTest.java
@Test public void testPackageName() throws Exception { // setup/* w w w.ja v a 2 s. c o m*/ String expectedName = StringUtils.EMPTY; int expectedVisibility = View.GONE; if (isDevelopmentMode) { expectedName = fixture.getPackageName(); expectedVisibility = View.VISIBLE; } // execute TextView actual = (TextView) fixture.findViewById(R.id.about_package_name); // validate assertNotNull(actual); assertEquals(expectedVisibility, actual.getVisibility()); assertEquals(expectedName, actual.getText()); }
From source file:com.jbirdvegas.mgerrit.ProjectsList.java
@Override public void onCreate(Bundle savedInstanceState) { this.setTheme(Prefs.getCurrentThemeID(this)); super.onCreate(savedInstanceState); setContentView(R.layout.projects_list); // Action bar Up affordance getActionBar().setDisplayHomeAsUpEnabled(true); mProjectsListView = (ExpandableListView) findViewById(R.id.projects); mProjectsListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override//from w ww . ja va 2 s. c om public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { TextView tv = (TextView) v; String subgroup = tv.getText().toString(); String root = mListAdapter.getGroupName(groupPosition); setProject(root, subgroup); return true; } }); mProjectsListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { TextView tv = (TextView) v; String group = tv.getText().toString(); if (mListAdapter.getChildrenCount(groupPosition) < 1) { setProject(group, ""); return true; } return false; } }); setSwipeRefreshLayout(); handleIntent(this.getIntent()); mEventBus = EventBus.getDefault(); // Todo: We don't always need to query the server here startService(); }
From source file:com.google.firebase.quickstart.fcm.MainActivity.java
private void saveDataTextView() { logDataTextView("BEFORE SAVE"); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); final TextView dataTextView = (TextView) findViewById(R.id.dataTextView); SharedPreferences.Editor edit = settings.edit(); edit.putString("dataTextView", (String) dataTextView.getText()); edit.apply();/*from w ww .ja v a2 s .co m*/ logDataTextView("AFTER SAVE"); }
From source file:com.aqnote.app.wifianalyzer.wifi.ConnectionViewTest.java
@Test public void testConnectionVisibleWithConnectionInformation() throws Exception { // setup/*from w ww . j av a 2 s .co m*/ WiFiAdditional wiFiAdditional = new WiFiAdditional(StringUtils.EMPTY, "IPADDRESS", 11); WiFiDetail connection = withConnection(wiFiAdditional); when(wiFiData.getConnection()).thenReturn(connection); when(wiFiData.getWiFiDetails(settings.getWiFiBand(), settings.getSortBy())) .thenReturn(new ArrayList<WiFiDetail>()); // execute fixture.update(wiFiData); // validate View view = mainActivity.findViewById(R.id.connection); assertEquals(View.VISIBLE, view.getVisibility()); TextView ipAddressView = (TextView) view.findViewById(R.id.ipAddress); assertEquals(View.VISIBLE, ipAddressView.getVisibility()); assertEquals(wiFiAdditional.getIPAddress(), ipAddressView.getText().toString()); TextView linkSpeedView = (TextView) view.findViewById(R.id.linkSpeed); assertEquals(View.VISIBLE, linkSpeedView.getVisibility()); assertEquals(wiFiAdditional.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS, linkSpeedView.getText().toString()); verify(wiFiData).getConnection(); verify(accessPointsDetail).setView(mainActivity.getResources(), view, connection, false); }
From source file:ca.ualberta.cs.shoven_habittracker.NewHabitActivity.java
public void saveNewHabit(View v, Schedule schedule) { EditText habitName = (EditText) findViewById(R.id.habitNameEditText); TextView habitDate = (TextView) findViewById(R.id.pickDateTextView); EditText habitComment = (EditText) findViewById(R.id.commentEditText); String[] splitDate = habitDate.getText().toString().split("-"); Integer year = Integer.parseInt(splitDate[0]); Integer month = Integer.parseInt(splitDate[1]); Integer day = Integer.parseInt(splitDate[2]); FormattedDate date = new FormattedDate(year, month, day); Habit habit = new Habit(habitName.getText().toString(), date, habitComment.getText().toString()); controller.addHabit(habit, schedule); Toast.makeText(this, "Habit added", Toast.LENGTH_SHORT).show(); }
From source file:com.microsoft.onedrive.apiexplorer.DeltaFragment.java
/** * Create a handler for downloaded pages * @return The callback to handle a fresh DeltaPage *///from w w w. ja va2 s . c o m private ICallback<IDeltaCollectionPage> pageHandler() { return new DefaultCallback<IDeltaCollectionPage>(getActivity()) { @Override public void success(final IDeltaCollectionPage page) { final View view = getView(); if (view == null) { return; } final View viewById = view.findViewById(R.id.json); if (viewById == null) { return; } if (mCurrentPagesCount.incrementAndGet() == MAX_PAGE_COUNT) { Toast.makeText(getActivity(), R.string.max_pages_downloaded, Toast.LENGTH_LONG).show(); return; } final TextView jsonView = (TextView) viewById; final CharSequence originalText = jsonView.getText(); final StringBuilder sb = new StringBuilder(originalText); for (final Item i : page.getCurrentPage()) { try { final int indentSpaces = 3; sb.append(new JSONObject(i.getRawObject().toString()).toString(indentSpaces)); } catch (final JSONException ignored) { Log.e(getClass().getName(), "Unable to parse the response body to json"); } sb.append("\n"); } if (page.getCurrentPage().size() == 0) { sb.append(getString(R.string.empty_delta)); } jsonView.setText(sb.toString()); view.findViewById(android.R.id.progress).setVisibility(View.INVISIBLE); jsonView.setVisibility(View.VISIBLE); if (page.getNextPage() != null) { page.getNextPage().buildRequest().get(pageHandler()); } final JsonElement deltaToken = page.getRawObject().get("@delta.token"); if (deltaToken != null) { getDeltaInfo().edit().putString(mItemId, deltaToken.getAsString()).commit(); } } }; }
From source file:com.bangz.shotrecorder.RecordDetailActivity.java
@Override public void onClick(View v) { if (v.getId() == R.id.imgEditDescript) { TextView textView = (TextView) findViewById(R.id.txtDescription); String strdescript = textView.getText().toString(); GetDescriptDialogFragment d = GetDescriptDialogFragment.newInstance(strdescript); d.show(getSupportFragmentManager(), "getDescriptDialogFragment"); }/* w ww . jav a2 s. c om*/ }
From source file:can.yrt.onebusaway.MySearchRoutesFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; final TextView text = (TextView) info.targetView.findViewById(R.id.short_name); menu.setHeaderTitle(getString(R.string.route_name, text.getText())); if (isShortcutMode()) { menu.add(0, CONTEXT_MENU_DEFAULT, 0, R.string.my_context_create_shortcut); } else {//from ww w . j av a 2 s.c om menu.add(0, CONTEXT_MENU_DEFAULT, 0, R.string.my_context_get_route_info); } menu.add(0, CONTEXT_MENU_SHOW_ON_MAP, 0, R.string.my_context_showonmap); final String url = getUrl(getListView(), info.position); if (url != null) { menu.add(0, CONTEXT_MENU_SHOW_URL, 0, R.string.my_context_show_schedule); } }
From source file:com.bangz.shotrecorder.RecordDetailActivity.java
@Override protected void onStop() { super.onStop(); if (mbModified) { ContentValues values = new ContentValues(); TextView v = (TextView) findViewById(R.id.txtDescription); String strDescript = v.getText().toString(); values.put(ShotRecord.ShotRecords.COLUMN_NAME_DESCRIPTION, strDescript); values.put(ShotRecord.ShotRecords.COLUMN_NAME_SHOTS, mManager.getNumbers()); values.put(ShotRecord.ShotRecords.COLUMN_NAME_SPENDTIME, mManager.getTotalElapsedTime()); values.put(ShotRecord.ShotRecords.COLUMN_NAME_SPLITS, mManager.toJSONString()); getContentResolver().update(mUri, values, null, null); mbModified = false;//from w w w .j a v a 2 s. c o m } }