1. Check out our companion app, Forums for Android! Download from Google Play

Add LinearLayout Icons to GridLayout

Discussion in 'Application Development' started by stth, Aug 23, 2010.

  1. stth

    stth New Member
    Thread Starter
    5

    Aug 23, 2010
    1
    0
    5
    Hello,
    i have the following questions/problems.

    i wrote an app to manage contactcards, i have already programmed starting the camera and save the pics on the sdcard under the following path "/sdcard/contactcards/<INPUTVALUE>" the filename is the content of an AutoCompleteTextview.

    I don't know if this is correct but i save the input value in a sharedpreferences file to know which cards are safed as follow:

    Code (Text):
    1.  
    2. SharedPreferences settings = getSharedPreferences(Overview.PREFS_NAME, 0);
    3. SharedPreferences.Editor editor = settings.edit();
    4. editor.putBoolean(acTextView.getText().toString(), true);
    5. editor.commit();
    6.  
    Now i want to show a Gridview with Icons of the saved cards, like the standard homescreen view where you can see all the apps.

    therefore i created a new xml file which should reflect the icon on the homescreen:

    Code (Text):
    1.  
    2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    3.     android:id="@+id/widget44" android:layout_width="wrap_content"
    4.     android:layout_height="wrap_content" android:orientation="vertical"
    5.     android:layout_x="201px" android:layout_y="165px" android:gravity="center_horizontal">
    6.     <ImageView android:id="@+id/icon_image" android:layout_width="wrap_content"
    7.         android:layout_height="wrap_content">
    8.     </ImageView>
    9.     <TextView android:id="@+id/icon_text" android:layout_width="wrap_content"
    10.         android:layout_height="wrap_content" android:text="TextView"
    11.         android:gravity="center_horizontal" android:textColorHighlight="#656565">
    12.     </TextView>
    13. </LinearLayout>
    14.  
    i tried a lot of things with Adapters LayoutInflater and so on i also read the examples of the ApiDemo but i got no results, only errors :(

    Can anybody help me to dynamically add the icons to my gridview, and can anybody say me whether my way of saving the result to sharedpreferences is correct?

    thanks a lot
    stefan
     

    Advertisement

Share This Page

Loading...