Search Results

Search found 911 results on 37 pages for 'textview'.

Page 11/37 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Android relative layout problem

    - by DixieFlatline
    Hello! I just can't display the button at the bottom of the screen. I have 2 textviews and 2 edittexts set as gone, and they become visible when user clicks checkbox. It's only then that my button gets positioned properly Otherwise it sits on top of the app at launch of my app.(see here: http://www.shrani.si/f/3V/10G/4nnH4DtV/layoutproblem.png) I also tried android:layout_alignParentBottom="true" but that doesnt help either. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview" android:layout_width="fill_parent" android:layout_height="wrap_content"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/txt1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Krajevna skupnost: " android:layout_alignParentTop="true" /> <Spinner android:id="@+id/spinner1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:prompt="@string/ks_prompt" android:layout_below="@id/txt1" /> <TextView android:id="@+id/txt2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Zadeva: " android:layout_below="@id/spinner1" /> <Spinner android:id="@+id/spinner2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:prompt="@string/pod_prompt" android:layout_below="@id/txt2" /> <TextView android:id="@+id/tv1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Zadeva: " android:layout_below="@id/spinner2" /> <EditText android:id="@+id/prvi" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/tv1" /> <TextView android:id="@+id/tv2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/prvi" android:text="Vsebina: " /> <EditText android:id="@+id/drugi" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/tv2" /> <CheckBox android:id="@+id/cek" android:text="Obvešcaj o odgovoru" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/drugi" /> <TextView android:id="@+id/tv3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/cek" android:text="Email: " android:visibility="gone"/> <EditText android:id="@+id/tretji" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/tv3" android:visibility="gone" /> <TextView android:id="@+id/tv4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/tretji" android:visibility="gone" android:text="Telefon: " /> <EditText android:id="@+id/cetrti" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" android:layout_below="@id/tv4" /> <Button android:id="@+id/gumb" android:text="Klikni" android:typeface="serif" android:textStyle="bold" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_below="@id/cetrti" /> </RelativeLayout> </ScrollView>

    Read the article

  • Limit number of charchters in uitextview !

    - by hib
    Hello All , I am giving a text view to tweet some string . I am applying the following method to restrict the number of characters to 140 in length. - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if([text isEqualToString:@"\b"]){ DLog(@"Ohoooo"); return YES; }else if([[textView text] length] > 140){ return NO; } return YES; } The code is working nicely except the first condition that backspace is not working. suppose that I have reached the limit of 140 characters so that the method will give me false and the user can not insert more characters but after that when I try to delete some characters the text view behave as it is disabled . So the question how do delete characters from textview.text or re-enable the text view .

    Read the article

  • KeyboardWillShow with UITextView

    - by Philip J
    Here's the setup: I have a textView (txtReply) where the user puts information I have a UIView that contains a scroll view and some labels, as well as the textView (ChatView) When the user selects the textView, then it brings the keyboard up. I use 'keyboardWillAppear' to move the 'ChatView' up so that the text view is still visible. I then have a reply button that submits the message, draws it into the ChatView, and calls [textView resignFirstResponder]. However, when I do this, it calls the keyboardWillHide, my view resizes, then the it brings the keyboard back up again. Is there something special you have to do to get the keyboard to stay hidden? Thanks

    Read the article

  • ListView items not responding to tap

    - by Justin Williams
    I'm just getting my feet wet with Android and have built a UI that contains a TabHost with three tabs. Each tab is powered by its own Activity. The first Tab contains a listview with a prepopulated set of rows and is built from a custom ArrayAdapter. The problem I'm running into is that none of the ListView rows are tappable. In other words, when I tap on them there is no orange selection. If I use the scroll ball on my Nexus One it will select, but any touch gestures don't seem to be responding. All the UI is being handled using XML files with a main.xml housing the TabHost - LinearLayout - TabWidget/FrameLayout and a nearby_activity.xml file containing my ListView UI <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/android:empty" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/nearby_no_events" /> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1.0" android:choiceMode="multipleChoice" android:divider="#d9d9d9" android:dividerHeight="1px" android:cacheColorHint="#eee" /> </LinearLayout> And the relevant code from my Activity that is set to show in the selected tab. public class NearbyActivity extends ListActivity { private ArrayList<Event> m_events = null; private EventAdapter m_adapter = null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nearby_activity); getEvents(); this.m_adapter = new EventAdapter(this, R.layout.eventrow, m_events); setListAdapter(this.m_adapter); } private void getEvents() { m_events = new ArrayList<Event>(); for (int i = 0; i < 100 ; i++) { Event e = new Event(); e.setEventName("Event " + i); e.setVenueName("Staples Center"); e.setStartDate(new Date()); m_events.add(e); } } private class EventAdapter extends ArrayAdapter<Event> { private ArrayList<Event> items; public EventAdapter(Context context, int textViewResourceId, ArrayList<Event> items) { super(context, textViewResourceId, items); this.items = items; } @Override public View getView (int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.eventrow, null); } Event e = items.get(position); if (e != null) { TextView nameText = (TextView)v.findViewById(R.id.eventName); TextView venueNameText = (TextView)v.findViewById(R.id.venueName); if (nameText != null) { nameText.setText(e.getEventName()); } if(venueNameText != null) { venueNameText.setText(e.getVenueName()); } } return v; } } } My listview row's are populated by an XML file as well. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:orientation="vertical" android:padding="4dip"> <TextView android:id="@+id/eventName" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:inputType="text" android:singleLine="true" android:ellipsize="marquee" android:textSize="18sp" android:textColor="#000" /> <TextView android:id="@+id/venueName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/eventName" android:layout_alignParentBottom="true" android:layout_marginRight="55dip" android:singleLine="true" android:ellipsize="end" android:scrollHorizontally="true" android:textSize="13sp" android:textColor="#313131" android:layout_alignWithParentIfMissing="true" android:gravity="center_vertical" /> </RelativeLayout> Thanks for any help you can offer.

    Read the article

  • listView dynamic add item

    - by pengwang
    hello,I used ListView to dynamic add item,but there is a problem about not Smooth add. there are textView and button in my listActivity,Iwant to Press button ,then textView"s text can auto add to listView,but i Pressed button ,it donot work,unless after i enter content , press "OK"Key ,then Pressed button ,textView"s text can auto add to listView. I donot know why. if I continuous Pressed button ,as3 times, then press "Ok"Key ,the content auto add list View but 3 times. public class DynamicListItems extends ListActivity { private static final String ITEM_KEY = "key"; ArrayList<HashMap<String, String>> list= new ArrayList<HashMap<String, String>>(); private SimpleAdapter adapter; private EditText newValue;@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dynamic_list); newValue = (EditText) findViewById(R.id.new_value_field); setListAdapter(new SimpleAdapter(this, list, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value })); ((ImageButton) findViewById(R.id.button)).setOnClickListener(getBtnClickListener()); } private OnClickListener getBtnClickListener() { return new OnClickListener() { public void onClick(View view) { try { HashMap<String, String> item = new HashMap<String, String>(); item.put(ITEM_KEY, newValue.getText().toString()); list.add(item); adapter.notifyDataSetChanged(); } catch (NullPointerException e) { Log.i("[Dynamic Items]", "Tried to add null value"); } } }; }} my another question is how to dynamic delete the item,which event i need to used,could you give me some directions or Code snippets? dynamic_list.xml only contains listView ,button,textView row.xml contains TextView . i amm sorry i donot edit code together.

    Read the article

  • How to dynamic adjust the number of columns in Table layout

    - by michael
    Hi, I create a TableLayout which has 3 equally-wide columns (I put 'stretchColumns="*" in my TableLayout which has 3 TextViews). See below: But my questions is why I set one of the TextView to 'visibility' to Gone in my java code, the TableLayout does not re-size to 2 qually-wide columns which fit the whole screen. I have even call 'tableLayout.requestLayout()' after i set the visibility to Gone.' How can I achieve what I want? Thank you. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textpanel" android:stretchColumns="*"> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text2" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text3" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </TableRow> </TableLayout>

    Read the article

  • How to dynamic adjust the width of columns in Table layout

    - by michael
    Hi, I create a TableLayout which has 3 equally-wide columns (I put 'stretchColumns="*" in my TableLayout which has 3 TextViews). See below: But my questions is why I set one of the TextView to 'visibility' to Gone in my java code, the TableLayout does not re-size to 2 qually-wide columns which fit the whole screen. I have even call 'tableLayout.requestLayout()' after i set the visibility to Gone.' How can I achieve what I want? Thank you. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textpanel" android:stretchColumns="*"> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text2" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/text3" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </TableRow> </TableLayout>

    Read the article

  • ScrollView in android

    - by rantravee
    hi, I' have a view that contains several textViews an ImageView and a Button . Because on small screen devices (or in landscape mode on big ones ) not all are visible I use a Scroll as the parent of the whole hierarchy to allow the user to view all the information. The things are suck that the button must be at the buttom of the view . However on big screen device , where it remains enough space at the buttom , the button is put immediatelly below the last textview,and seems to occupy all the remaining space (resulting in an unnactractive view) . Trying to use android:allignParentButtom ="true" not only that it has no effect but it puts the button at top of the screen . Has anyone any ideea how could I accomplish what I described ? here's the xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true"> <RelativeLayout android:id="@+id/gps_info_page1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerHorizontal="true"> <TextView android:id="@+id/itsDateTimeValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="@string/eStrUnknown"> </TextView> <RelativeLayout android:id="@+id/directions" android:layout_centerHorizontal="true" android:layout_below="@+id/itsDateTimeValue" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/itsDirectionValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="2dip" android:textSize="20sp"> </TextView> <TextView android:id="@+id/itsOrientation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" android:layout_marginLeft="2dip" android:text="@string/eStrUnknown" android:layout_toRightOf="@+id/itsDirectionValue"> </TextView> </RelativeLayout> <ImageView android:id="@+id/itsImage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/compass" android:layout_below="@+id/directions" android:layout_centerHorizontal="true"> </ImageView> <RelativeLayout> ..."TextViews below the above image" </RelativeLayout> <RelativeLayout> ..."TextViews below the above" </RelativeLayout> <RelativeLayout> ..."TextViews below the above" </RelativeLayout> <RelativeLayout> ..."TextViews below the above" </RelativeLayout> <RelativeLayout ..."TextViews below the above" </RelativeLayout> <LinearLayout android:id="@+id/div" android:layout_width="fill_parent" android:layout_height="1dip" android:layout_below="@+id/sunset_layout" android:background="#F333"> </LinearLayout> <Button //adding here android:alignParentBottom="true" has described above behavior android:layout_marginBottom="3dip" android:layout_marginTop="20dip" android:id="@+id/done_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/eStrDone" android:textSize="18sp" android:layout_below="@+id/div" android:layout_centerHorizontal="true"> </Button> </RelativeLayout> </ScrollView>

    Read the article

  • 'object' undeclared <first use in this function>

    - by Mohit Deshpande
    I am using Winchain to develop on my Windows 7 machine. Here is my code: iPhoneTest.h #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface iPhoneTest : UIApplication { UITextView *textview; UIView *mainView; } @end iPhoneTest.m #import "iPhoneTest.h" #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import <CoreFoundation/CoreFoundation.h> @implementation iPhoneTest -(void)applicationDidFinishLaunching:(id)unused { UIWindow *window; struct CGRect rect = [UIHardware fullScreenApplicationContentRect]; rect.origin.x = rect.origin.y = 0.0f; window = [[UIWindow alloc] initWithContentRect: rect]; mainView = [[UIView alloc] initWithFrame: rect]; textView = [[UITextView alloc] init]; [textView setEditable:YES]; [textView setTextSize:14]; [window orderFront: self]; [window makeKey: self]; [window _setHidden: NO]; [window setContentView: mainView]; [mainView addSubview:textView]; [textView setText:@"Hello World"]; } @end main.m #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "iPhoneTest.h" int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int ret = UIApplicationMain(argc, argv, [iPhoneTest class]); [pool release]; return ret; } Makefile INFOPLIST_FILE=Info.plist SOURCES=\ main.m \ iPhoneTest.m CC=/usr/local/bin/arm-apple-darwin-gcc CFLAGS=-g -O2 -Wall LD=$(CC) LDFLAGS=-lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework LayerKit PRODUCT_NAME=iPhoneTest SRCROOT=/iphone-apps/iPhoneTest WRAPPER_NAME=$(PRODUCT_NAME).app EXECUTABLE_NAME=$(PRODUCT_NAME) SOURCES_ABS=$(addprefix $(SRCROOT)/,$(SOURCES)) INFOPLIST_ABS=$(addprefix $(SRCROOT)/,$(INFOPLIST_FILE)) OBJECTS=\ $(patsubst %.c,%.o,$(filter %.c,$(SOURCES))) \ $(patsubst %.cc,%.o,$(filter %.cc,$(SOURCES))) \ $(patsubst %.cpp,%.o,$(filter %.cpp,$(SOURCES))) \ $(patsubst %.m,%.o,$(filter %.m,$(SOURCES))) \ $(patsubst %.mm,%.o,$(filter %.mm,$(SOURCES))) OBJECTS_ABS=$(addprefix $(CONFIGURATION_TEMP_DIR)/,$(OBJECTS)) APP_ABS=$(BUILT_PRODUCTS_DIR)/$(WRAPPER_NAME) PRODUCT_ABS=$(APP_ABS)/$(EXECUTABLE_NAME) all: $(PRODUCT_ABS) $(PRODUCT_ABS): $(APP_ABS) $(OBJECTS_ABS) $(LD) $(LDFLAGS) -o $(PRODUCT_ABS) $(OBJECTS_ABS) $(APP_ABS): $(INFOPLIST_ABS) mkdir -p $(APP_ABS) cp $(INFOPLIST_ABS) $(APP_ABS)/ $(CONFIGURATION_TEMP_DIR)/%.o: $(SRCROOT)/%.m mkdir -p $(dir $@) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ clean: echo rm -f $(OBJECTS_ABS) echo rm -rf $(APP_ABS) When I try to compile it with make, I get iPhoneTest.m: In fucntion '-[iPhoneTest applicationDidFinishLaunching:]' iPhoneTest.m:15: error: 'testView' undeclared <first use in this function> iPhoneTest.m:15: error: <Each undeclared identifier is reported only once for each function it appears in> Can anyone spot the problem?

    Read the article

  • Android Uncaught Exception

    - by Agrim Asthana
    09-30 02:32:31.474: D/ddm-heap(214): Got feature list request 09-30 02:32:31.634: D/AndroidRuntime(214): Shutting down VM 09-30 02:32:31.634: W/dalvikvm(214): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 09-30 02:32:31.634: E/AndroidRuntime(214): Uncaught handler: thread main exiting due to uncaught exception 09-30 02:32:31.654: E/AndroidRuntime(214): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mjcet.mjcet/com.mjcet.mjcet.MJCET}: java.lang.ClassNotFoundException: com.mjcet.mjcet.MJCET in loader dalvik.system.PathClassLoader@44e8c820 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.os.Handler.dispatchMessage(Handler.java:99) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.os.Looper.loop(Looper.java:123) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.main(ActivityThread.java:4363) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.reflect.Method.invokeNative(Native Method) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.reflect.Method.invoke(Method.java:521) 09-30 02:32:31.654: E/AndroidRuntime(214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 09-30 02:32:31.654: E/AndroidRuntime(214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 09-30 02:32:31.654: E/AndroidRuntime(214): at dalvik.system.NativeStart.main(Native Method) 09-30 02:32:31.654: E/AndroidRuntime(214): Caused by: java.lang.ClassNotFoundException: com.mjcet.mjcet.MJCET in loader dalvik.system.PathClassLoader@44e8c820 09-30 02:32:31.654: E/AndroidRuntime(214): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 09-30 02:32:31.654: E/AndroidRuntime(214): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 09-30 02:32:31.654: E/AndroidRuntime(214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409) 09-30 02:32:31.654: E/AndroidRuntime(214): ... 11 more 09-30 02:32:31.684: I/dalvikvm(214): threadid=7: reacting to signal 3 09-30 02:32:31.684: E/dalvikvm(214): Unable to open stack trace file '/data/anr/traces.txt': Permission denied the above is my debugging output for the below activities LOGINACTIVITY.java package com.agrim.mjcet; import com.agrim.mjcet.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; //import android.widget.TextView; import android.widget.Button; import android.widget.EditText; import android.view.View.OnClickListener; public class LoginActivity extends Activity { EditText txtUserName; EditText txtPassword; Button btnLogin; Button btnCancel; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setting default screen to login.xml setContentView(R.layout.main); txtUserName=(EditText)this.findViewById(R.id.txtUname); txtPassword=(EditText)this.findViewById(R.id.txtPwd); btnLogin=(Button)this.findViewById(R.id.btnLogin); btnLogin=(Button)this.findViewById(R.id.btnLogin); btnLogin.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Switching to Register screen if((txtUserName.getText().toString()).equals(txtPassword.getText().toString())) { Intent myIntent = new Intent(getApplicationContext(),SampleActivity.class); startActivityForResult(myIntent, 0); } } } ); } } SAMPLE ACTIVITY.java package com.agrim.mjcet; import com.agrim.mjcet.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class SampleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set View to register.xml setContentView(R.layout.lol); TextView HomeScreen = (TextView) findViewById(R.id.back); HomeScreen.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // Closing registration screen // Switching to Login Screen/closing register screen finish(); } }); } } and here are my 2 layouts MAIN.XML <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" android:stretchColumns="1"> <TableRow> <TextView android:text="@string/user_name" android:textColor="#347235" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_marginLeft="25dip" android:layout_height="wrap_content"> </TextView> <EditText android:text="" android:inputType="text" android:id="@+id/txtUname" android:layout_weight="0.75" android:layout_width="wrap_content" android:layout_marginRight="10dip" android:layout_marginBottom="5dip" android:background="#FFFFFF" android:layout_height="wrap_content"> </EditText> </TableRow> <TableRow> <TextView android:text="@string/password" android:textColor="#347235" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dip"> </TextView> <EditText android:text="" android:inputType="textPassword" android:id="@+id/txtPwd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dip" android:layout_weight="1" android:background="#FFFFFF" android:gravity="center"> </EditText> </TableRow> <TableRow> <Button android:id="@+id/btnLogin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:layout_marginTop="25dip" android:layout_marginLeft="50dip" android:onClick="onClickMyButton" android:text="@string/login" /> <Button android:id="@+id/btnCancel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:layout_marginTop="25dip" android:layout_marginLeft="100dip" android:layout_marginRight="50dip" android:text="@string/cancel" /> </TableRow> <FrameLayout android:layout_width="wrap_content" android:layout_height="match_parent" > <ImageView android:layout_width="fill_parent" android:layout_height="match_parent" android:scaleType="centerInside" android:src="@drawable/logo_invert" android:contentDescription="@drawable/logo_invert"/> </FrameLayout> </TableLayout> and finally LOL.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:background="#000000" android:layout_height="fill_parent" > <ImageView android:layout_width="fill_parent" android:id="@+id/back" android:layout_height="match_parent" android:scaleType="centerInside" android:src="@drawable/lol" android:contentDescription="@drawable/lol"> </ImageView> <RelativeLayout android:layout_width="match_parent" android:layout_height="138dp" android:orientation="vertical" android:gravity="bottom" > <TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="@string/coming_soon" android:textColor="#347235" /> </RelativeLayout> </FrameLayout> I get a force close upon initialization.. and yes this is my first android app :)

    Read the article

  • Gallery items become off-center when switching into landscape orientation.

    - by Sandile
    Hey Guys, Thanks for your time. I'm writing an application for android 2.2 and I'm using a gallery to circulate through a list of images that the user can then click to navigate other portions of the application. In portrait orientation, everything is kosher: the images are displaying correctly (completely in the center of the screen as I intended); however, in landscape orientation, all the images in the gallery are strangely displaced a fixed distance to the left of the center of the screen. I've been researching this issue for hours now and haven't found a solution. I'm hoping that some android guru can aid me in the resolution of this bizarre rendering issue. MainMenuActivity.java relevant code snippet (the activity in which the gallery resides) Gallery optionList = (Gallery)findViewById(R.id.mainMenuOptionList); GalleryItem[] optionListItemIdArray = new GalleryItem[] { new GalleryItem(R.drawable.icon_main_menu_option_list_blackboard, "Start Next Lesson", "Start the next planned vocab lesson."), new GalleryItem(R.drawable.icon_main_menu_option_list_index_cards, "Review Words", "Manually look over old words."), new GalleryItem(R.drawable.icon_main_menu_option_list_dice, "Play Vocab Games", "Play games to reinforce knowledge."), new GalleryItem(R.drawable.icon_main_menu_option_list_calendar, "View Lesson Plan", "View the schedule for coming lessons."), new GalleryItem(R.drawable.icon_main_menu_option_list_pie_chart, "View Performance Report", "Evaluate your overall performance statistics."), new GalleryItem(R.drawable.icon_main_menu_option_list_settings, "Manage Settings", "Change and modify application settings.") }; optionList.setAdapter(new GalleryImageAdapter(this, optionListItemIdArray)); NOTE: A GalleryItem is a POJO with an image resource id, title and description. GalleryImageAdapter.java: public class GalleryImageAdapter extends BaseAdapter { private Context context; private GalleryItem[] galleryItemArray; public GalleryImageAdapter(Context context, GalleryItem[] galleryItemArray) { this.context = context; this.galleryItemArray = galleryItemArray; } @Override public int getCount() { return galleryItemArray.length; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); imageView.setImageResource(galleryItemArray[position].getImageId()); imageView.setScaleType(ImageView.ScaleType.FIT_START); imageView.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.WRAP_CONTENT, Gallery.LayoutParams.WRAP_CONTENT)); return imageView; } } Portrait version of main_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuLinearLayout" android:background="#3067a8" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#ffffff" android:textSize="50sp" android:text="@string/main_menu_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuSubHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="15dip" android:textColor="#ffffff" android:textSize="15sp" android:text="@string/main_menu_sub_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionList" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="20dip" android:paddingBottom="10dip" android:spacing="40dip" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionListDetailLinearLayout" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuOptionListLabelTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="25sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuOptionListDescriptionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="15sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> </LinearLayout> </LinearLayout> Landscape version of main_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuLinearLayout" android:background="#3067a8" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#ffffff" android:textSize="50sp" android:text="@string/main_menu_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuSubHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="15dip" android:textColor="#ffffff" android:textSize="15sp" android:text="@string/main_menu_sub_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionList" android:layout_width="fill_parent" android:layout_height="128dip" android:paddingLeft="0dip" android:paddingTop="5dip" android:spacing="10dip" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionListDetailLinearLayout" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuOptionListLabelTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="25sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuOptionListDescriptionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="15sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> </LinearLayout> </LinearLayout> Thank you for your time!

    Read the article

  • Android XML - how to get items aligned far left, center, and far right

    - by 68060
    Hi, I have this XML code which generates a button, a textview and another button, How do I go about getting the button to appear in far left, the textview in the center and the last button on the far right? < ?xml version="1.0" encoding="utf-8"?> < LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" <Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Cancel"> </Button> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Place"> </TextView> <Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Save"> </Button>

    Read the article

  • Android/Java Beginner: Overriding ArrayAdapter's getView

    - by Preformed Cone
    Firstly I am new to android and Java so this is a beginners question. I have some code that overrides the ArrayAdapter's getView method. Here is the code public View getView(int position, View convertView, ViewGroup parent) { TextView label = (TextView)convertView; if (convertView == null) { convertView = new TextView(ctxt); label = (TextView)convertView; } label.setText(items[position]); return (convertView); } My question is: why does label.setText(items[position]); affect the convertView return value? How are they related / linked?

    Read the article

  • AutoCompleteTextView showing suggestions only for the first word entered

    - by DixieFlatline
    Hello! My autocompletetextview shows suggestions only for the first entered word. So if i write "ki" suggestions for king will popup. But if i enter "queen whitespace ki" there will be no suggestion for king. textView = (AutoCompleteTextView) findViewById(R.id.predlogi); String[] pred = getResources().getStringArray(R.array.predlogi); ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, pred); textView.setAdapter(adapter); textView.setThreshold(2); Is there any property that should be set to textView?

    Read the article

  • Save UITextView content in NSString.

    - by camilo
    Hi, I'm trying to save the contents of an UITextView into a NSString which I will somehow persist later. The problem is that the UITextView "text" property doesn't save all the rows in the textView (after touching "return"). I tried print the TextView object and the textView.text, and they're different. Does anybody know how (after editing the textView) I can save its content into a String (or something else that I can later access and share through different views and persist in the database)? Thanks a lot. Pretty sure it is simple, but I'm honestly not finding the solution.

    Read the article

  • Problem with UITextView

    - by user367039
    I have a strange problem with trying to pass a string from one viewcontroller to another view controller if the string originates from a UITextview instead of UITextfield. Both UITextview.text and UITextfield.text are of type NSString. The following code takes either Textfield.text or Textview.text depending on the fieldType and puts it into a string called aString. NSString *aString = [[NSString alloc] init]; if (fieldType == 3) { aString = textView.text; } else { aString = textField.text; } When I examine aString on either cases, I can see that it has successfully assigned the text into aString. I then pass the string to the other view controller using this code. [delegate updateSite:aString :editedFieldKey :fieldType]; [self.navigationController popViewControllerAnimated:YES]; This works fine if aString originated from textfield.text but nothing happens except the view controller is popped if aString was from textview.text This is the code that takes aString and does stuff with it, however it doesn't even execute the first line of code "NSLog(@"Returned object: %@, field type:%@", aString,editedFieldKey);" if aString was from textview.text Any help will be appreciated. -(void)updateSite:(NSString *)aString :(NSString *)editedFieldKey :(int)fieldType { NSLog(@"Returned object: %@, field type:%@", aString,editedFieldKey); switch (fieldType) { case 0: //string [aDiveSite setValue:aString forKey:editedFieldKey] ; NSLog(@"String set %@",[aDiveSite valueForKey:editedFieldKey] ); break; case 1: //int [aDiveSite setValue:[NSNumber numberWithInt:aString.intValue] forKey:editedFieldKey]; NSLog(@"Integer set"); break; case 2: //float NSLog(@"Saving floating value"); [aDiveSite setValue:[NSNumber numberWithFloat:aString.floatValue] forKey:editedFieldKey]; NSLog(@"Float set"); break; case 3: //Text view [aDiveSite setValue:aString forKey:editedFieldKey]; NSLog(@"Textview text saved"); default: break; } [self.tableView reloadData]; }

    Read the article

  • Problem in getting response from webserver

    - by Amarpreet
    Hi guys I am sending data to webserver in the Querystrings by creating URL dynamically. When I view that URl in UIAlertView it shows me correct one. And when i try to get response using NSURL code, it does not respond. Below is the code. NSString *uu = @"http://www.zenhomeenergy.com/ZenIphoneServUpdate.aspx?CustomerID=12&FirstName=Andrew&LastName=Turner&State=SA&Street=60 Highfiled Drive Hillbank no phone number&PostCode=5112&Email= &Mobile= &HomePhone= &WorkPhone= &PrimaryResidence=True&HomeOwner=True"; NSString *text = [NSString stringWithContentsOfURL:[NSURL URLWithString:uu]]; if(text) { if([text isEqualToString:@"Success."]) { textView.text = [textView.text stringByAppendingString:@"Success.\n"]; } else { textView.text = [textView.text stringByAppendingString:@"Failed.\n"]; } } If you try putting the above URL into browser it says "Success." But the code above doesnot work. Please Help.

    Read the article

  • android custom dialog imageButton onclicklistener

    - by Asaf Nevo
    this is my custom dialog class: package com.WhosAround.Dialogs; import com.WhosAround.AppVariables; import com.WhosAround.R; import com.WhosAround.AsyncTasks.LoadUserStatus; import com.WhosAround.Facebook.FacebookUser; import android.app.Dialog; import android.content.Context; import android.graphics.drawable.Drawable; import android.view.MotionEvent; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; public class MenuFriend extends Dialog{ private FacebookUser friend; private AppVariables app; public MenuFriend(Context context, FacebookUser friend) { super(context, android.R.style.Theme_Translucent_NoTitleBar); this.app = (AppVariables) context.getApplicationContext(); this.friend = friend; } public void setDialog(String userName, Drawable userProfilePicture) { setContentView(R.layout.menu_friend); setCancelable(true); setCanceledOnTouchOutside(true); TextView name = (TextView) findViewById(R.id.menu_user_name); TextView status = (TextView) findViewById(R.id.menu_user_status); ImageView profilePicture = (ImageView) findViewById(R.id.menu_profile_picture); ImageButton closeButton = (ImageButton) findViewById(R.id.menu_close); name.setText(userName); profilePicture.setImageDrawable(userProfilePicture); if (friend.getStatus() != null) status.setText(friend.getStatus()); else new LoadUserStatus(app, friend, status).execute(0); closeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); } }) } } for some reason eclipse tells me the following errors on closeButton imageButton: The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new DialogInterface.OnClickListener(){}) The type new DialogInterface.OnClickListener(){} must implement the inherited abstract method DialogInterface.OnClickListener.onClick(DialogInterface, int) The method onClick(View) of type new DialogInterface.OnClickListener(){} must override or implement a supertype method why is that ?

    Read the article

  • Rows added to table are not showing up

    - by Lars
    This has been asked before, but I have found no solution that worked for me yet: When adding rows to a table from code, the rows are not showing up in the application. There is one row I specified in XML, that one is showing up, but nothing below it. This is the code: public void addRow(LocationMessage locationMsg){ View messageView = theInflater.inflate(R.layout.homepage, null); TableLayout table = (TableLayout)messageView.findViewById(R.id.distanceTable); TextView senderNameTextView = new TextView(thisContext); senderNameTextView.setText(locationMsg.getSenderName()); TableRow tr = new TableRow(thisContext); tr.addView(distanceTextView); table.addView(tr); rows.addFirst(messageView); } homepage.xml contains this, I removed some elements and parameters: <?xml version="1.0" encoding="utf-8"?> <LinearLayout> <TabHost> <TabWidget /> <FrameLayout> [..] <LinearLayout> [..] <TableLayout android:id="@+id/distanceTable" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:background="#DDDDDD" android:stretchColumns="1" > <TableRow> <TextView android:textColor="#000000" android:text="@string/label_device" android:layout_gravity="center" android:padding="3dip" android:textSize="18sp" /> <TextView android:textColor="#000000" android:text="@string/label_distance" android:layout_gravity="center" android:padding="3dip" android:textSize="18sp" /> <TextView android:textColor="#000000" android:text="@string/label_time" android:layout_gravity="center" android:padding="3dip" android:textSize="18sp" /> </TableRow> </TableLayout> </LinearLayout> </FrameLayout> </TabHost> </LinearLayout> Unfortunately hierarchyviewer.bat doesn't work for me in order to check if the rows are there but just not visible. In the debugger it looks fine to me.

    Read the article

  • Strange Java Coding??? Class in class???

    - by poeschlorn
    Hi guys, I got a question about Java coding in general... In some sample codes there are methods and classes declared WITHIN other methods and/or classes.... I've never heard/red about this...what effect does this kind of programming have? Wouldn't it be better to write down classes in a seperate file and methods side by side and not within each other (like every book tells you)? What are the advantages and disadvantages of this kind of programming? Here's an example of what I mean: Handler mHandler = new Handler() { public void handleMessage(android.os.Message msg) { TextView textView = (TextView) findViewById(R.id.description); textView.setText(mRoad.mName + " " + mRoad.mDescription); MapOverlay mapOverlay = new MapOverlay(mRoad, mapView); List<Overlay> listOfOverlays = mapView.getOverlays(); listOfOverlays.clear(); listOfOverlays.add(mapOverlay); mapView.invalidate(); }; };

    Read the article

  • how can i set mTextView to show on button click

    - by Ajay Pandey
    i have a UITextView object which i have created in interface builder with it's hidden property unmarked.Now i want this textView to be invisible when my application launches and first view appears.Further i want it to be displayed when a particular method is called.Now this is what i have written in view did load [mTextView setHidden:YES]; self.mTextView=[[UITextView alloc] init]; it hides the textView ats the first view appears but when my desired method is called and i write [mTextView setHidden:NO]; it does not show it again.. Is it like we cant change the appearance of a textView once it is assigned because after assigning memory as self.mTextView=[[UITextView alloc] init]; and then writing [mTextView setHidden:YES]; it does not hide textView in viwDidLoad either.....

    Read the article

  • Custom android preference type loses focus when typing

    - by Brian
    I created a simple preference class that shows an AutoCompleteTextView control and it displays properly but when i focus on the AutoCompleteTextView and start typing it brings up the keyboard but then immediately loses focus on the control. Any idea why this loses focus? Here's what i did to create the view. the inflated layout is just a basic linear layout with a title textview in it. I could change it to a dialog preference instead I guess but it'd be smoother if it could be part of the base view. @Override protected View onCreateView(ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.base_preference, null); if (mHint != null) { TextView hintView = (TextView) layout.findViewById(R.id.PreferenceHintTextView); hintView.setText(mHint); } TextView titleView = (TextView) layout.findViewById(R.id.PreferenceTitleTextView); titleView.setText(getTitle()); AutoCompleteTextView inputView = new AutoCompleteTextView(getContext()); inputView.setGravity(Gravity.FILL_HORIZONTAL); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(), R.layout.auto_complete_text_list_item, getEntries()); inputView.setAdapter(adapter); inputView.setThreshold(1); inputView.setOnItemSelectedListener(this); layout.addView(inputView); return layout; }

    Read the article

  • When marking an item (changing background color) in ListView it's repeating for other items.

    - by Adi
    If I want to mark the second item I'm doing the following code: This code is from my Adapter that extends ArrayAdapter : if (convertView == null) { LayoutInflater mInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.channel_list, null); } MyContent o = items.get(position); if (o != null) { TextView tt = (TextView) convertView.findViewById(R.id.toptext); TextView bt = (TextView) convertView.findViewById(R.id.bottomtext); if (tt != null) { tt.setText(o.Top()); } if(bt != null){ bt.setText(o.Bottom()); } if(position == 2) { convertView.setBackgroundColor(R.color.selectem_color); } } return convertView; It will show the list view but mark every 9'th item after this item (the 11'th item 13'th and so on). Does anyone know what's the reason?

    Read the article

  • What's the solution for this gtk warning?

    - by Runner
    GtkWidget *textview; ... textview = gtk_text_view_new (); ... buffer = gtk_text_view_get_buffer (textview); At the last line I pasted I got this warning: warning C4133: 'function' : incompatible types - from 'GtkWidget *' to 'GtkTextView *' How can I fix that?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >