settext

setText doesn't set text to EditText

故事扮演 提交于 2019-12-04 06:44:18
I'm having a problem that I've never had before in almost three years of developing with Android... I want to take a picture and after the picture is taked, the EditText s of the activity become clear. What I'm doing is set the values of the EditText to Strings using getText().toString() to restore them after taking the picture. The strings are stored perfectly with the data, but when I use setText , it doesn't work... The strange thing is that setHint works! How can it be? Here's the code I'm using: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if

How to update a UILabel in Xcode programmatically without XIB files?

蹲街弑〆低调 提交于 2019-12-04 03:02:36
I'm stuck :( In my application I require an update from CLLocationManager every time it gets an update to a new position. I am not using XIB/NIB files, everything I coded I have done programmatically. To the code: the .h @interface TestViewController : UIViewController UILabel* theLabel; @property (nonatomic, copy) UILabel* theLabel; @end the .m ... -(void)loadView{ .... UILabel* theLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,20.0)]; theLabel.text = @"this is some text"; [self.view addSubView:theLabel]; [theLabel release]; // even if this gets moved to the dealloc method,

Set text of spinner before item is selected

一世执手 提交于 2019-12-03 13:00:50
I have a spinner with three items and I use an XML string-array resource to feed it. When you open an activity the spinner normally shows the first item that's in the array list. I'd like to change that and show the text "Select one" in the spinner, before an item is selected. How can I do that? You can do that one of two ways. 1) Add "Select One" as the first item in your xml and code your listener to ignore that as a selection. 2) Create a custom adapter to insert it as the first line, EDIT In your resources <string-array name="listarray"> <item>Select One</item> <item>Item One</item> <item

proplem in updating JLabel in for loop

强颜欢笑 提交于 2019-12-02 19:56:11
问题 The idea of my program is to select one name from a list that saved before in other JFrame. I'd like to print in the label all names one after the other with small delay between them, and after that stop at one of them. The problem is that lbl.setText("String"); doesn't work if there is more than one setText code. Here is the part of my code : public void actionPerformed(ActionEvent e) { if (RandomNames.size != 0) { for (int i = 0; i < 30; i++) { int rand = (int)(Math.random() * RandomNames

Null TextView object in a fragment

心已入冬 提交于 2019-12-02 16:30:11
问题 I'm working on dynamically setting a text of TextView in a fragment called 'ChallengeFragment' by creating a method that sets the text. Then, I call the method in FragmentActivity class to update the TextView. However, I am getting error that TextView object is null when the method is called. I am not sure why TextView is null. Here's the logcat message: 16:36:02.437 4072-4072/eie.android.crunch E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: eie.android.crunch, PID: 4072 java.lang

Android setText in asynctask

邮差的信 提交于 2019-12-02 12:49:47
问题 I'm working on a UDP program but I'm having trouble with applying setText in my asynctask . Basically on the UDP server, I just ask to input a port and then the server should connect to the localhost and the port. A TextView in the middle of the layout says "Currently not connected" and when I click connect to a port, I want it to change to "Connected." However, it is not doing anything. I tried searching around but was unable to come up with a solution. If anyone can help me figure out the

Null TextView object in a fragment

落花浮王杯 提交于 2019-12-02 12:35:44
I'm working on dynamically setting a text of TextView in a fragment called 'ChallengeFragment' by creating a method that sets the text. Then, I call the method in FragmentActivity class to update the TextView. However, I am getting error that TextView object is null when the method is called. I am not sure why TextView is null. Here's the logcat message: 16:36:02.437 4072-4072/eie.android.crunch E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: eie.android.crunch, PID: 4072 java.lang.RuntimeException: Unable to start activity ComponentInfo{eie.android.crunch/eie.android.crunch.ChallengePage}:

how to set new text in JTextField after creation?

和自甴很熟 提交于 2019-12-02 09:42:41
问题 I have a jTextField , and I set it's value to a certain sum when I create the frame. Here is the initiation code: totalTextField.setText( itemsPriceTextField.getText() + Float.toString(orderDetails.delivery) ); This textfield should show a sum of items selected by the user. The selection is done on a different frame, and both frames are visible / invisible at a time. The user can go back and forth and add / remove items. Now, every time i set this frame visible again, I need to reload the

proplem in updating JLabel in for loop

自作多情 提交于 2019-12-02 07:47:53
The idea of my program is to select one name from a list that saved before in other JFrame. I'd like to print in the label all names one after the other with small delay between them, and after that stop at one of them. The problem is that lbl.setText("String"); doesn't work if there is more than one setText code. Here is the part of my code : public void actionPerformed(ActionEvent e) { if (RandomNames.size != 0) { for (int i = 0; i < 30; i++) { int rand = (int)(Math.random() * RandomNames.size); stars.setText(RandomNames.list.get(rand)); try { Thread.sleep(100); } catch (InterruptedException

Android SetText changes keyboard type

吃可爱长大的小学妹 提交于 2019-12-02 05:07:48
问题 I'm developing an android application which contains an EditText . I control what is written in the editText by calling et.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { String message = et.getText().toString(); if(s.toString().compareTo(before)!=0){ et.setText(message); et.setSelection(et.getText().length()); } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { before = et.getText().toString(); System.out.println("After")