List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.cloudtask1.AccountsActivity.java
/** * Sets up the 'connect' screen content. *//*ww w. j a va 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) { finish(); } }); 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) { // Set "connecting" status SharedPreferences prefs = Util.getSharedPreferences(mContext); prefs.edit().putString(Util.CONNECTION_STATUS, Util.CONNECTING).commit(); // Get account name mAccountSelectedPosition = listView.getCheckedItemPosition(); TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition); // Register register((String) account.getText()); finish(); } }); } }
From source file:nz.ac.wintec.soit.af5.AccountsActivity.java
/** * Sets up the 'connect' screen content. *//* ww w. ja va 2 s . com*/ 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) { finish(); } }); 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) { // Set "connecting" status SharedPreferences prefs = Util.getSharedPreferences(mContext); prefs.edit().putString(Util.CONNECTION_STATUS, Util.CONNECTING).commit(); // Get account name mAccountSelectedPosition = listView.getCheckedItemPosition(); TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition); // Register register((String) account.getText()); finish(); } }); } }
From source file:chat.client.gui.ChatActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { final TextView chatField = (TextView) findViewById(R.id.chatTextView); savedInstanceState.putString("chatField", chatField.getText().toString()); super.onSaveInstanceState(savedInstanceState); }
From source file:com.amfontai.cmput301asn1.WordLog.java
/** * @see android.app.Activity#onCreate(android.os.Bundle) *//*from w w w . ja v a 2s.c o m*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_word_log); // Show the Up button in the action bar. setupActionBar(); // Here we get the views from the layout file TextView characters = (TextView) findViewById(R.id.characters); TextView words = (TextView) findViewById(R.id.words); TextView logs = (TextView) findViewById(R.id.logs); TextView topHundred = (TextView) findViewById(R.id.top); /* Here we query the DB for the statistics and * add them to the displayed string */ characters.setText(characters.getText() + " " + Long.toString(mDb.totalCharacters())); words.setText(words.getText() + " " + Long.toString(mDb.totalWords())); logs.setText(logs.getText() + " " + Long.toString(mDb.totalEntries())); for (String word : mDb.topHundred()) topHundred.setText(topHundred.getText() + " " + word); }
From source file:com.example.android.amplacenta.GuestFragment.java
/** * Set up the UI and background operations for chat. *///from ww w. j a v a 2 s . c o m private void joinParty() { Log.d(TAG, "joinParty()"); // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key mOutEditText.setOnEditorActionListener(mWriteListener); // Initialize the send button with a listener that for click events mSendButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Send a message using content of the edit text widget View view = getView(); if (null != view) { TextView textView = (TextView) view.findViewById(R.id.edit_text_out); String message = textView.getText().toString(); sendMessage(message); } } }); // Initialize the GuestService to perform bluetooth connections guestService = new GuestService(getActivity(), mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); }
From source file:com.masteriti.manager.AccountsActivity.java
/** * Sets up the 'connect' screen content. *//*from www.j a va 2 s.c om*/ 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() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT)); } }); builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); 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() { @Override public void onClick(View v) { // Set "connecting" status SharedPreferences prefs = Util.getSharedPreferences(mContext); prefs.edit().putString(Util.CONNECTION_STATUS, Util.CONNECTING).commit(); // Get account name mAccountSelectedPosition = listView.getCheckedItemPosition(); TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition); // Register register((String) account.getText()); finish(); } }); } }
From source file:com.cloudbase.cbhelperdemo.SettingsScreen.java
@Override // save the settings to the SharedPreferences and initialise the helper public void onClick(View v) { Log.d("DEMOAPP", "onClick"); editor = settings.edit();/*from w w w . ja v a2 s . co m*/ TextView appText = (TextView) this.getView().findViewById(R.id.appCodeText); TextView appUniqText = (TextView) this.getView().findViewById(R.id.appUniqText); TextView pwdText = (TextView) this.getView().findViewById(R.id.appPwdText); TextView c2dmText = (TextView) this.getView().findViewById(R.id.c2dmText); appCode_ = appText.getText().toString(); appUniq_ = appUniqText.getText().toString(); appPwd_ = md5(pwdText.getText().toString()); gcmProjectId_ = c2dmText.getText().toString(); editor.putString("app_code", appCode_); editor.putString("app_uniq", appUniq_); editor.putString("app_pwd", appPwd_); editor.putString("c2dm_email", gcmProjectId_); editor.commit(); this.initHelper(true); }
From source file:com.collecdoo.fragment.main.RegisterDriverPhotoFragment.java
private void setColorSpan(TextView textView, int fromPos, int toPos) { SpannableStringBuilder sb = new SpannableStringBuilder(textView.getText()); ForegroundColorSpan fcs = new ForegroundColorSpan(Color.RED); sb.setSpan(fcs, fromPos, toPos, Spannable.SPAN_INCLUSIVE_INCLUSIVE); textView.setText(sb);//from w w w .j a v a2s . com }
From source file:com.cpen391.module2.hikingpal.bluetooth.BluetoothChatFragment.java
/** * Set up the UI and background operations for chat. *//*from w ww .ja v a 2s. c om*/ private void setupChat() { // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key mOutEditText.setOnEditorActionListener(mWriteListener); // Initialize the send button with a listener that for click events mSendButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Send a message using content of the edit text widget View view = getView(); if (null != view) { TextView textView = (TextView) view.findViewById(R.id.edit_text_out); String message = textView.getText().toString(); sendMessage(message); } } }); // Initialize the BluetoothChatService to perform bluetooth connections mChatService = new BluetoothChatService(getActivity(), mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); }
From source file:mad.codeforcommunity.CalendarView.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.calendar);// w w w.j a v a 2s.com month = Calendar.getInstance(); // onNewIntent(getIntent()); items = new ArrayList<String>(); adapter = new CalendarAdapter(this, month); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(adapter); handler = new Handler(); handler.post(calendarUpdater); TextView title = (TextView) findViewById(R.id.title); title.setText(android.text.format.DateFormat.format("MMMM yyyy", month)); TextView previous = (TextView) findViewById(R.id.previous); previous.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (month.get(Calendar.MONTH) == month.getActualMinimum(Calendar.MONTH)) { month.set((month.get(Calendar.YEAR) - 1), month.getActualMaximum(Calendar.MONTH), 1); } else { month.set(Calendar.MONTH, month.get(Calendar.MONTH) - 1); } refreshCalendar(); } }); TextView next = (TextView) findViewById(R.id.next); next.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (month.get(Calendar.MONTH) == month.getActualMaximum(Calendar.MONTH)) { month.set((month.get(Calendar.YEAR) + 1), month.getActualMinimum(Calendar.MONTH), 1); } else { month.set(Calendar.MONTH, month.get(Calendar.MONTH) + 1); } refreshCalendar(); } }); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { TextView date = (TextView) v.findViewById(R.id.date); ImageView image = (ImageView) v.findViewById(R.id.date_icon); if (date instanceof TextView && !date.getText().equals("")) { if (image.getVisibility() == View.VISIBLE) { /*OLD CODE * Intent intent = new Intent(); String day = date.getText().toString(); if(day.length()==1) { day = "0"+day; } // return chosen date as string format intent.putExtra("date", android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day); setResult(RESULT_OK, intent); finish(); */ Bundle extras = new Bundle(); String day = date.getText().toString(); if (day.length() == 1) { day = "0" + day; } // return chosen date as string format extras.putString("date", android.text.format.DateFormat.format("yyyy-MM", month) + "-" + day); Intent intent = new Intent(CalendarView.this, EventView.class); intent.putExtras(extras); startActivity(intent); } } } }); }