List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:app.jorge.mobile.com.transportalert.ScrollingActivity.java
@Override public void onResponse(Response<List<StatusLine>> response, Retrofit retrofit) { if (response.isSuccess()) { tubeStatus = new HashMap<>(); int size = response.body().size(); for (int i = 0; i < size; i++) { StatusLine statusLine = response.body().get(i); String nameKey = statusLine.getName(); LineStatuses lineStatuses = statusLine.getLineStatuses().get(0); //String status =response.body().get(i).getLineStatuses().get(0).getStatusSeverityDescription(); tubeStatus.put(nameKey, lineStatuses); }//from ww w . j av a2s . com //String name=response.body().get(0).getName(); //String status =response.body().get(0).getLineStatuses().get(0).getStatusSeverityDescription(); // Toast.makeText( getContext(), "You Clicked hey "+ status, Toast.LENGTH_SHORT).show(); LinearLayout item = (LinearLayout) findViewById(R.id.rv); int childcount = item.getChildCount(); for (int i = 0; i < childcount; i++) { View child = item.getChildAt(i); TextView lineName = (TextView) child.findViewById(R.id.tubeName); String line_id = lineName.getText().toString(); String message = tubeStatus.get(line_id).getStatusSeverityDescription(); if (message != null) { TextView text = (TextView) child.findViewById(R.id.tubeStatus); text.setText(message); } } } else { int statusCode = response.code(); // handle request errors ResponseBody errorBody = response.errorBody(); Toast.makeText(getApplicationContext(), "Error code " + errorBody.toString() + " " + statusCode, Toast.LENGTH_SHORT).show(); } }
From source file:com.example.android.TalkingShoes.BluetoothChat.java
private void setupChat() { Log.d(TAG, "setupChat()"); // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message); mConversationView = (ListView) findViewById(R.id.in); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key mOutEditText = (EditText) findViewById(R.id.edit_text_out); mOutEditText.setOnEditorActionListener(mWriteListener); // Initialize the send button with a listener that for click events mSendButton = (Button) findViewById(R.id.button_send); mSendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Send a message using content of the edit text widget TextView view = (TextView) findViewById(R.id.edit_text_out); String message = view.getText().toString(); sendMessage(message);/*from w w w. j a v a 2 s.c o m*/ } }); //initialize share button for google+ shareButton = (Button) findViewById(R.id.share_button); shareButton.setOnClickListener(this); shareButton.setOnTouchListener(this); // Initialize the BluetoothChatService to perform bluetooth connections mChatService = new BluetoothChatService(this, mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); }
From source file:com.javielinux.dialogs.EditColumnDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { int title = R.string.edit; View v = View.inflate(getActivity(), R.layout.edit_column_dialog, null); final TextView name = (TextView) v.findViewById(R.id.edit_column_name); name.setText(ColumnsUtils.getTitleColumn(getActivity(), entity)); return new AlertDialog.Builder(getActivity()).setTitle(title).setView(v) .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { @Override/*from ww w . j a va2 s . co m*/ public void onClick(DialogInterface dialogInterface, int i) { entity.setValue("description", name.getText().toString()); entity.setValue("user_desc_as_title", 1); entity.save(); try { callable.call(); } catch (Exception e) { e.printStackTrace(); } } }).setNegativeButton(R.string.cancel, null).create(); }
From source file:can.yrt.onebusaway.RouteInfoListFragment.java
private void showOnMap(View v) { final TextView text = (TextView) v.findViewById(R.id.stop_id); final String stopId = (String) text.getText(); // we need to find this route in the response because // we need to know it's lat/lon ObaStop stop = mStopsForRoute.getStopMap().get(stopId); if (stop == null) { return;/* w ww. ja va2 s . c om*/ } HomeActivity.start(getActivity(), stopId, stop.getLatitude(), stop.getLongitude()); }
From source file:com.cloudbase.cbhelperdemo.NotificationScreen.java
@Override public void onClick(View v) { TextView channelText = (TextView) this.getView().findViewById(R.id.channelText); TextView notifText = (TextView) this.getView().findViewById(R.id.notifText); String regId = MainActivity.gcmRegistrationId; if (regId != null && !regId.equals("")) { // if we have a registration id. if (v.getId() == R.id.subscribeButton) { // subscribe to a notification channel MainActivity.helper.notificationSubscribeDevice(regId, channelText.getText().toString(), false); }/*ww w . j av a2s . c o m*/ if (v.getId() == R.id.unsubscribeButton) { // unsubscribe from a channel MainActivity.helper.notificationUnsubscribeDevice(regId, channelText.getText().toString()); } if (v.getId() == R.id.pushNotifButton) { // send a push notification. This needs to be enabled in the security settings in the // application's cloudbase.io control panel - allow client devices to send notifications //MainActivity.helper.sendNotification(notifText.getText().toString(), channelText.getText().toString(), false); MainActivity.helper.sendGCMNotification(notifText.getText().toString(), "", "", "", "all", true); } } else { Log.d("DEMOAPP", "The application is not registered for C2DM notifications"); } }
From source file:can.yrt.onebusaway.RouteInfoListFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; if (ExpandableListView .getPackedPositionType(info.packedPosition) != ExpandableListView.PACKED_POSITION_TYPE_CHILD) { return;/*w w w. j a va 2 s. c om*/ } final TextView text = (TextView) info.targetView.findViewById(R.id.name); menu.setHeaderTitle(text.getText()); menu.add(0, CONTEXT_MENU_DEFAULT, 0, R.string.route_info_context_get_stop_info); menu.add(0, CONTEXT_MENU_SHOWONMAP, 0, R.string.route_info_context_showonmap); }
From source file:com.andrew.apolloMod.activities.QueryBrowserActivity.java
@Override protected void onListItemClick(ListView l, View v, int position, long id) { // Dialog doesn't allow us to wait for a result, so we need to store // the info we need for when the dialog posts its result mQueryCursor.moveToPosition(position); if (mQueryCursor.isBeforeFirst() || mQueryCursor.isAfterLast()) { return;//www.j av a2 s .c o m } String selectedType = mQueryCursor.getString(mQueryCursor.getColumnIndexOrThrow(Audio.Media.MIME_TYPE)); if ("artist".equals(selectedType)) { Intent intent = new Intent(Intent.ACTION_VIEW); TextView tv1 = (TextView) v.findViewById(R.id.listview_item_line_one); String artistName = tv1.getText().toString(); Bundle bundle = new Bundle(); bundle.putString(MIME_TYPE, Audio.Artists.CONTENT_TYPE); bundle.putString(ARTIST_KEY, artistName); bundle.putLong(BaseColumns._ID, id); intent.setClass(this, TracksBrowser.class); intent.putExtras(bundle); startActivity(intent); finish(); } else if ("album".equals(selectedType)) { TextView tv1 = (TextView) v.findViewById(R.id.listview_item_line_one); TextView tv2 = (TextView) v.findViewById(R.id.listview_item_line_two); String artistName = tv2.getText().toString(); String albumName = tv1.getText().toString(); Bundle bundle = new Bundle(); bundle.putString(MIME_TYPE, Audio.Albums.CONTENT_TYPE); bundle.putString(ARTIST_KEY, artistName); bundle.putString(ALBUM_KEY, albumName); bundle.putLong(BaseColumns._ID, id); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(this, TracksBrowser.class); intent.putExtras(bundle); startActivity(intent); finish(); } else if (position >= 0 && id >= 0) { long[] list = new long[] { id }; MusicUtils.playAll(this, list, 0); } else { Log.e("QueryBrowser", "invalid position/id: " + position + "/" + id); } }
From source file:can.yrt.onebusaway.RouteInfoListFragment.java
private void showArrivals(View v) { final TextView text = (TextView) v.findViewById(R.id.stop_id); final String stopId = (String) text.getText(); ObaStop stop = null;/*from www . j a va 2s . co m*/ if (mStopsForRoute != null) { stop = mStopsForRoute.getStopMap().get(stopId); } ArrivalsListActivity.Builder b = new ArrivalsListActivity.Builder(getActivity(), stopId); if (stop != null) { b.setStopName(stop.getName()); b.setStopDirection(stop.getDirection()); } b.setUpMode(NavHelp.UP_MODE_BACK); b.start(); }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
private void selectRow(int index) { if (index != selectedIndex) { if (selectedIndex >= 0) { deselectRow(selectedIndex);//from ww w . j a va2s.c o m } TableRow tr = (TableRow) tl.findViewWithTag(index); tr.setBackgroundColor(Color.LTGRAY); selectedIndex = index; TextView tv = (TextView) tr.getChildAt(0); selectedMake = tv.getText().toString(); tv = (TextView) tr.getChildAt(1); selectedModel = tv.getText().toString(); tv = (TextView) tr.getChildAt(2); selectedLicensePlate = tv.getText().toString(); Vehicle v = getVehicle(selectedLicensePlate); sprof_make.setText(v.getMake()); sprof_model.setText(v.getModel()); sprof_color.setText(v.getColor()); sprof_year.setText(v.getYear()); sprof_licenseplate.setText(v.getLicensePlate()); } }
From source file:com.myandroidremote.AccountsActivity.java
/** * Sets up the 'connect' screen content. *///from w w w . j a v a 2 s. c o m private void setConnectScreenContent() { List<String> accounts = getGoogleAccounts(); if (accounts.size() == 0) { // Show a dialog and invoke the "Add Account" activity if requested AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage(R.string.needs_account); builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT)); } }); builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { showLoadingScreen(); } }); builder.setIcon(android.R.drawable.stat_sys_warning); builder.setTitle(R.string.attention); builder.show(); } else { final ListView listView = (ListView) findViewById(R.id.select_account); listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts)); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); listView.setItemChecked(mAccountSelectedPosition, true); final Button connectButton = (Button) findViewById(R.id.connect); connectButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Register in the background and terminate the activity mAccountSelectedPosition = listView.getCheckedItemPosition(); TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition); register((String) account.getText()); // show connecting showLoadingScreen(); } }); final Button exitButton = (Button) findViewById(R.id.exit); exitButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { finish(); } }); } }