Thanks for this solution.

On Jul 10, 4:14 am, camandroid <[email protected]> wrote:
> Apparently bindFavorites() aims only to retrieve the favorite
> application.
> Since we don't have this file /system/etc/favorites.xml, we are not
> obliged to manage it.
>
> What I did is:
>     - initialize mFavorites at the top and
>     - fill it from favReader only if favReader != null.
>
> of course at the step: mApplicationsStack.setFavorites(mFavorites);
>   mFavorites is an empty list.
> But this will prevent the crash in
> ApplicationsStackLayout.stackApplications(List<ApplicationInfo>
> applications, int childLeft, int childTop)
>     applications (comes from mFavorites) is then not null.
>
> private void bindFavorites(boolean isLaunching) {
>  if (!isLaunching || mFavorites == null) {
>
>              if (mFavorites == null) {
>                  mFavorites = new LinkedList<ApplicationInfo>();
>              } else {
>                  mFavorites.clear();
>              }
>
>              FileReader favReader = null;
>  // Environment.getRootDirectory() is a fancy way of saying
> ANDROID_ROOT or "/system".
>             final File favFile = new File(Environment.getRootDirectory
> (), DEFAULT_FAVORITES_PATH);
>             try {
>                 favReader = new FileReader(favFile);
>             } catch (FileNotFoundException e) {
>                 Log.e(LOG_TAG, "Couldn't find or open favorites file "
> + favFile);
>             }
>
>             if (favReader != null) {
>                     final Intent intent = new Intent(Intent.ACTION_MAIN,
> null);
>                     final PackageManager packageManager =
> getPackageManager();
>
>                     try {
>                       ...
>                      } catch (XmlPullParserException e) {
>                         Log.w(LOG_TAG, "Got exception parsing favorites.",
> e);
>                     } catch (IOException e) {
>                         Log.w(LOG_TAG, "Got exception parsing favorites.",
> e);
>                     }
>             }
>         }
>
>         mApplicationsStack.setFavorites(mFavorites);
>
> }
>
> This works fine for me.
>
> I'd like to simulate the  /system/etc/favorites.xml
> Anyone knows it format ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to