Getting the application icon to show in the launcher

by Bret Foreman » Tue, 25 Jan 2011 02:19:35 GMT


Sponsored Links
 I created a simple app with a single activity and a 64X64 pixel png
icon. But I'm seeing the default Android icon instead of my drawable.
The icon is in res/drawable/icon.png and the manifest is as shown. I
also tried adding an icon attribute to the activity but that didn't
change - it's still just showing the default icon in the launcher. Any
idea what I might be doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
      package="com.speakez"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name" android:debuggable="true">
        <activity android:name=".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>

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

<uses-permission android:name="android.permission.CALL_PHONE"></uses-
permission>
</manifest>

-- 



Re: Getting the application icon to show in the launcher

by Kostya Vasilyev » Tue, 25 Jan 2011 02:30:39 GMT


 Bret,

Not sure if this is it, but the standard icon size for mdpi is 48x48, not
64x64:

 http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html #size5

The manifest looks fine.

-- Kostya

2011/1/24 Bret Foreman <bret.fore...@gmail.com>


-- 


Sponsored Links


Re: Getting the application icon to show in the launcher

by Bret Foreman » Tue, 25 Jan 2011 02:38:02 GMT


 It didn't help. I resized the image, un-installed the app, did a clean
build, and re-installed. Still getting the default icon.

-- 



Re: Re: Getting the application icon to show in the launcher

by Mark Murphy » Tue, 25 Jan 2011 02:43:15 GMT


 Reboot the device/emulator, and see if that helps. You could also add
an android:icon attribute to the <activity> element, though that
should not be required.

Also, see if there are any interesting messages in LogCat.




-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training in London:  http://bit.ly/smand1 and http ://bit.ly/smand2

-- 



Re: Re: Getting the application icon to show in the launcher

by Kostya Vasilyev » Tue, 25 Jan 2011 02:46:58 GMT


 Are you sure that this is your icon?

android:icon="@drawable/icon"

Did you delete all the versions of icon.png that were generated by the
Eclipse Android app wizard?

Check res/drawable-mdpi, res/drawable-hdpi, maybe it's still lurking there.
And if you are using a high-res device, then that's what you'll get.

-- Kostya


2011/1/24 Bret Foreman <bret.fore...@gmail.com>


-- 



Re: Getting the application icon to show in the launcher

by Bret Foreman » Tue, 25 Jan 2011 02:51:56 GMT


 That was it! I knew it had to be something simple. A bunch of default
icons in the drawable-resolution folders.

-- 



Other Threads

1. Problem while creating a new file

Hi,I am trying to create a new file using the class File.
Below is my code snippet

File testFile = new File("/data/tests.txt");
if (!testFile.exists()) {
      System.out.println("--------------File does not exist: ");
}

Initially I don't have the file tests.txt under data path. So, I am trying
to create it.After creating the file I am making a check is the file exists
or not. But it is says that file doesn't exist.
Can any one please help me out or how to create a new file and write data
into that file.

Thanks
Ashok.V

--~--~---------~--~----~------------~-------~--~----~

2. Screen Goes Black Between Activities, and Next Activity never shows up.

>From my MainActivity the user can click a button that shows a dialog.
seconds from a custom Timer component, and click a start button. When
they click start, this is the OnClickListener that gets invoked.

   public void onClick(DialogInterface dialog, int whichButton) {
        AlertDialog alertDialog = (AlertDialog)dialog;
        Timer timer = (Timer)alertDialog.getWindow().findViewById
(R.id.timer);

        Intent intent = new Intent(MainActivity.this,CountDown.class);
        intent.putExtra(KEY_MINUTES, timer.getMinutes());
        intent.putExtra(KEY_SECONDS, timer.getSeconds());
        startActivity(intent);
        //startActivityForResult(intent, ACTIVITY_COUNT_DOWN);
   }

As you can see it is sent to the CountDown activity. What is supposed
to happen is the minutes and seconds that the user selected from the
dialog are displayed on the CountDown screen, and they begin to count
down and an explosion sound is played when zero is reached. What is
really happening, For some reason the screen goes black, and nothing
is displayed, however the explosion is played 30 seconds later if user
selected 30 seconds. The CountDown Activity has two methods onCreate
and  onWindowFocusChanged. OnCreate is used to set up the view and
onWindowFocusChanged is used to count down and update the view as each
second pasts. I put the count down code in the  onWindowFocusChanged
because it there is no user intervention except to watch the time
count down, and according to the android documentation this is the
best indicator that the activity is visible to the user.http://
code.google.com/android/reference/android/app/
Activity.html#onWindowFocusChanged(boolean). See my code below.


   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.count_down);

       //instantiate the components
       mMinutesText = (TextView)findViewById(R.id.count_down_minutes);
       mSecondsText = (TextView)findViewById(R.id.count_down_seconds);
       cancelButton = (Button)findViewById(R.id.count_down_cancel);

       Bundle extras = getIntent().getExtras();
       mMinutes = extras.getInt(KEY_MINUTES);
       mMinutesText.setText(mMinutes);

       mSeconds = extras.getInt(KEY_SECONDS);
       mSecondsText.setText(mSeconds);

       cancelButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                mIsCountingDown = false;
        setResult(RESULT_OK,new Intent());
        finish();
            }
        });
}

@Override
public void onWindowFocusChanged(boolean hasFocus){
    super.onWindowFocusChanged(hasFocus);
    if(hasFocus){
        countDown(mMinutes,mSeconds);
        if(mMinutes == 0 && mSeconds == 0){
        MediaPlayer mp = MediaPlayer.create(this, mSound);
        mp.start();
        }

        Intent mIntent = new Intent();
        setResult(RESULT_OK,mIntent);
        finish();
     }
}


Here are logs from LogCat. I am wondering if this "Launch timeout has
expired, giving up wake lock!" is the problem. If this is the problem
then what is causing it

12-30 02:40:31.926: INFO/ActivityManager(53): Displayed activity
com.android.myapp/.CountDown: 14992 ms
12-30 02:41:40.408: INFO/ActivityManager(53): Starting activity:
Intent { comp={com.android.myapp/com.android.myapp.CountDown} (has
extras) }
12-30 02:41:50.454: WARN/ActivityManager(53): Launch timeout has
expired, giving up wake lock!
12-30 02:41:50.549: WARN/ActivityManager(53): Activity idle timeout
for HistoryRecord{43524f10 {com.android.myapp/
com.android.myapp.CountDown}}
12-30 02:42:00.166: INFO/ActivityManager(53): Displayed activity
com.android.myapp/.CountDown: 19743 ms

Any guidance someone can provide would be very helpful.

Skooter :)
--~--~---------~--~----~------------~-------~--~----~

3. Why the webkit just send to plugin 20 bytes through NPP_Write

4. Accessing 24 Hour View preference

5. About OMA download

6. Synchronizing Maps and Map Overlays - ConcurrentModificationException

7. Capture and Playback