I made a simple android app that contains only some image buttons in a GridLayout, while running it on eclipse it runs without any problems or errors but when coming to the emulator it gives me nothing and when run it in my tablet it crashes,
Hint: it's not something in the emulator or the adb as the other projects run perfectly and when changing this code this project runs perfectly too, so it's something with the code.
Update: i found that the problem is in the Gridlayout as when i changed it to LinearLayout it worked, but for sure i want it to be a Grid one as the Linear Layout doesn't serve my work.
this is my .xml file :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".Main" >
<GridLayout
android:id="@+id/grid1"
android:layout_width="fill_parent"
android:layout_height="500dp"
android:layout_centerInParent="true"
android:background="@android:color/darker_gray"
android:columnCount="1"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/homeview" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="right|top"
android:layout_row="0"
android:src="@drawable/profiles" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="center"
android:layout_row="0"
android:src="@drawable/ac" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="center"
android:layout_row="1"
android:src="@drawable/appliances" />
<ImageButton
android:id="@+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="right|center_vertical"
android:layout_row="1"
android:src="@drawable/movies" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left|center_vertical"
android:layout_row="1"
android:src="@drawable/lightning" />
</GridLayout>
</RelativeLayout>