Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7029769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:34:55+00:00 2026-05-28T00:34:55+00:00

I am trying to write an application that starts off from a main menu

  • 0

I am trying to write an application that starts off from a main menu (a gridview) and then creates a new activity based on the icon that is clicked by the user. Right now I am trying to simply display a blank screen for one of the icons to make sure I can successfully create a new activity. My main activity is called HomeScreen and the new activity which should be launched when I click on the first icon is called CulpaActivity. I am posting HomeScreen, CulpaActivity, and the Manifest.

public class HomeScreen extends Activity {
    /** Called when the activity is first created. */
    @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        GridView gridview = (GridView) findViewById(R.id.gridview);
        gridview.setAdapter(new ImageAdapter(this));
        Drawable background = this.getResources().getDrawable(R.drawable.bg);
        gridview.setBackgroundDrawable(background);

    gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Toast.makeText(HomeScreen.this, "" + position, Toast.LENGTH_SHORT).show();

            Intent cuAppIntent = null;
            switch (position){
            case 0:
                cuAppIntent.setClass(HomeScreen.this, CulpaActivity.class);
            }   
        }
    });    
    }
}

public class CulpaActivity extends Activity{
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        GridView gridview = (GridView) findViewById(R.id.gridview);
        gridview.setAdapter(new ImageAdapter(this));
        gridview.setBackgroundDrawable(null);
    }
}

And here is the Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="columbia.android"
android:versionCode="1"
android:versionName="1.0" >

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:resizeable="true"
    android:smallScreens="true" />

<application
    android:debuggable="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name" >
    <activity
        android:label="@string/app_name"
        android:name=".HomeScreen" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".CulpaActivity" >
    </activity>
</application>

<uses-sdk android:minSdkVersion="8" />

<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:34:56+00:00Added an answer on May 28, 2026 at 12:34 am

    I think this is your problem:

    Intent cuAppIntent = null;
    

    You define cuAppIntent as null yet you directly access cuAppIntent.setClass() without initializing cuAppIntent first.

    switch (position){
        case 0:
            cuAppIntent.setClass(HomeScreen.this, CulpaActivity.class);
    } 
    

    To fix it, try to initialize first:

    Intent cuAppIntent = new Intent();
    

    and then add:

    startActivity(cuAppIntent);
    

    right after calling cuAppIntent.setClass()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a javascript application that loads data from the openstreetmap API
I'm trying to write a silverlight application that takes in InitParams and then uses
I am trying to write an MFC dialog based application that reads the information
I'm trying to write an application that converts 48 bit-per-pixel PNG files to a
I am trying to write an application that uses java.net.Socket. I have also written
I'm trying to write an application that responds whenever the Shift key is pressed,
I am trying to write an application that performs operations on a grid of
Hi I am trying to write an application that will play morse code. I
I'm trying to write an application (winforms) that can demonstrate how two oscillating colors
I'm trying to write a small application that needs to use the clipboard for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.