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 7162809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:47:47+00:00 2026-05-28T13:47:47+00:00

Now I would like to make shortcut, so my code is ShortcutIconResource icon =

  • 0

Now I would like to make shortcut, so my code is

    ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
    Intent intent = new Intent();
    Intent launchIntent = new Intent(this, ActivityToLaunch.class);

    intent.putExtra( Intent.EXTRA_SHORTCUT_INTENT, launchIntent );
    intent.putExtra( Intent.EXTRA_SHORTCUT_NAME, /*someNickname()*/"" );
    intent.putExtra( Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon );   
    setResult(RESULT_OK, intent); 

But I got this error message.

ActivityToLaunch cannot be resolved to a type

In stackoverflow, I saw many codes such as

Intent launchIntent = new Intent(this, ActivityToLaunch.class);

What’s the matter?

My project uses android sdk version 2.2, and imports

import android.app.Activity;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
import android.os.Bundle;

My manifest.xml is

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

<activity android:name=".ShortCutActivity" android:label="@string/shortcut_label">  

       <intent-filter>  
              <action android:name="android.intent.action.CREATE_SHORTCUT" />     
              <category android:name="android.intent.category.DEFAULT" />   
       </intent-filter> 
</activity>
<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".TestActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>
</manifest>

and apkname is and com.my.mytest.

Please help me.

Thanks.

  • 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-28T13:47:48+00:00Added an answer on May 28, 2026 at 1:47 pm

    Is ActivityToLaunch actual name of your activity? Because according to your manifest what you need is probably

    Intent launchIntent = new Intent(this, ShortCutActivity.class);
    

    or

    Intent launchIntent = new Intent(this, TestActivity.class);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked the question here and now i would like to reverse this procedure
Thanks for a solution in C , now I would like to achieve this
I have this string stored in a variable: IN=bla@some.com;john@home.com Now I would like to
I have drawn an icon in Inkscape , but would now like to programmatically
I have made a Java Swing application. Now I would like to make it
I have just started to use Apache Maven. Now I would like to make
I made an iPhone application, and now I would like to make multiple more
I would now like to make an app that works on basically all html5
I have written a small Perl script and now I would like to create
I'm using iBATIS to create select statements. Now I would like to implement the

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.