Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMUZ140835 Simbarashe Newengo
4,625 PointsWhere am i missing it,everything looks perfectly in place to me....
Now switch over to ProductsActivity.java and convert it to use the new GridView. Use the comments in the code as your guide to create and set mGridView in this simplified example.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
import android.os.Bundle;
import android.widget.GridView;
// This parent class no longer applies. Switch it to Activity
public class ProductsActivity extends ListActivity {
/*
* Some code has been omitted for brevity!
*/
GridView mGridView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_products);
mGridView=(GridView)findViewById(R.id.gridView);
}
}
3 Answers
Ben Deitch
Treehouse TeacherCheck out the first comment in ProductsActivity.java :)
MUZ140835 Simbarashe Newengo
4,625 PointsI don't know how to deal with that comment.That's what got me stuck.How do i go about it.That is my question,sir.
Ben Deitch
Treehouse TeacherSince we're no longer using a ListView we shouldn't be extending ListActivity. Switch it to Activity.
MUZ140835 Simbarashe Newengo
4,625 PointsSo we just delete list from ListActivity????