simple search widget


Last Updated:

  1. v1nsai

    v1nsai Well-Known Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    60
    Likes Received:
    3
    I'm flexing my java muscles for the first time in a while and trying out Android SDK. I'm trying to write a simple search widget for my home screen, but as of right now I can't even get it to display the 3 elements I have defined in a LinearLayout in any kind of window.

    I've written the main.xml and strings.xml, and I'm using a basic setContentView to call it, like so
    Code (Text):
    1. public class gSearch extends Activity {
    2.     /** Called when the activity is first created. */
    3.     @Override
    4.     public void onCreate(Bundle savedInstanceState) {
    5.         super.onCreate(savedInstanceState);
    6.         setContentView(R.layout.main);
    7.     }
    8. }
    Here's main.xml
    Code (Text):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    3.     android:orientation="horizontal"
    4.     android:layout_width="fill_parent"
    5.     android:layout_height="fill_parent"
    6.     >
    7.     <ImageView
    8.         android:id="@+id/gicon"
    9.         android:src="@drawable/gicon"
    10.         android:adjustViewBounds="true"
    11.         android:layout_height="fill_parent"
    12.     />    
    13.     <EditText
    14.         android:id="@+id/searchstring"
    15.         android:layout_width="fill_parent"
    16.         android:layout_height="wrap_content"
    17.         android:text="@string/hello"
    18.     />
    19.     <Button
    20.         android:id="@+id/search"
    21.         android:layout_width="fill_parent"
    22.         android:layout_height="fill_parent"
    23.         android:text="Go!"
    24.     />
    25. </LinearLayout>
    26.  
    and strings.xml
    Code (Text):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <resources>
    3.     <string name="hello">Enter search here</string>
    4.     <string name="app_name">gSearch</string>
    5. </resources>
    6.  
    I think thats all the relevant info, this should be the easy part but its had me stuck in a rut for a while now, could someone give me a push? :-D

    EDIT:
    I found some more errors in the debugger, the boostrapper isn't finding /sys/class/switch/test or test2 and its causing more errors. Now trying to figure out what that means -_-
     

    Advertisement

Share This Page

Loading...