Skip to content Skip to sidebar Skip to footer

Startactivity Not Working

public void onItemClick(AdapterView parent, View view, int position, long id) { //Toast.makeText(getApplicationContext(), 'Position of selected

Solution 1:

In your code try to use an intent to start activity:

   Intent i = newIntent(ACTUALACTIVITY.this, OTHERACTIVITY.class);
                startActivity(i);

and in your manifest put your activity full address (package.activity) like below:

<application>
(...)
            <activityandroid:name="packagename.YOURACTIVITY"></activity></application>

Solution 2:

Try to create Intent and start Activity passing this intent like

// Create intent to start new Activity
Intent intent = newIntent(context, YourActivity.class);
startActivity(intent);

Solution 3:

The startActivity method takes an Intent as parameter. Yo are trying to pass a class and that's why you get the "red underline"

try this:

if ("Abiding in Christ".equals(categories[position]))
            {startActivity(new Intent(this, AbidingInChrist.class));}
    elseif ("Abundant Living".equals(categories[position]))
            {startActivity(new Intent(this, AbundantLiving.class));}
    elseif ("Access to God".equals(categories[position]))
            {startActivity(new Intent(this, AccessToGod.class));}
    elseif ("Adoration of God".equals(categories[position]))
            {startActivity(new Intent(this, AdorationOfGod.class));}
    elseif ("Amazing Grace".equals(categories[position]))
            {startActivity(new Intent(this, AmazingGrace.class));}

Also in you manifest don't forget to close the quotes when you declare an activity

<activityandroid:name=".AbidingInChrist"></activity><activityandroid:name=".AbundantLiving"></activity><activityandroid:name=".AccessToGod"></activity>

etc

Post a Comment for "Startactivity Not Working"