0

The problem that i am facing, is that my GridView, only Opens, from Main Menu, and not as child, or second Activity, .

in my code, i am trying to open a Grid View (Second Activity), from my MainActivity (First GridView). the first grid view will open, with out any hesitation, but when i try to get to second GridView, it will Crash my App.

Here is the code :

gvMainMenu.setAdapter(new ImageAdapter(this));
gvMainMenu.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView parent, View v, int position,
                long id) {
            if(position == 1){
                startActivity(new Intent(MainActivity.this, MenuActivity.class));                   
            }
            else{
                Toast.makeText(getBaseContext(), "Pic" + (position + 1),
                        Toast.LENGTH_SHORT).show();
            }


        }
    });

}

My Manifiest File:

<activity
        android:name="com.example.advaceviews.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.advaceviews.MenuActivity"
        android:label="Gallery View" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
asadnwfp
  • 733
  • 6
  • 10

1 Answers1

0

Problem was solved, it was , My Layout, that was creating the Problem, .. Had Nested, GridView, inside, LinearLayout, .. when removed, . the LinearLayout, .. .Problem got solved, .!

asadnwfp
  • 733
  • 6
  • 10