• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Add LinearLayout Icons to GridLayout

stth

Lurker
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:
SharedPreferences settings = getSharedPreferences(Overview.PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean(acTextView.getText().toString(), true);
editor.commit();

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:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:id="@+id/widget44" android:layout_width="wrap_content"
	android:layout_height="wrap_content" android:orientation="vertical"
	android:layout_x="201px" android:layout_y="165px" android:gravity="center_horizontal">
	<ImageView android:id="@+id/icon_image" android:layout_width="wrap_content"
		android:layout_height="wrap_content">
	</ImageView>
	<TextView android:id="@+id/icon_text" android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:text="TextView"
		android:gravity="center_horizontal" android:textColorHighlight="#656565">
	</TextView>
</LinearLayout>

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
 
Back
Top Bottom