[android-developers] Re: Can a core class access resources at the app layer?

2009-09-24 Thread Andy Droid

Thanks, Dianne.  I tested your suggestion with two apps, where one app
gets resources from another app, and it worked.  Doing it at the
framework layer is more difficult, but it may be more of a build
problem.

I made a change to frameworks/base/core/java/android/widget/
AbsListView.java  did a mmm frameworks/base, and then make snod.
I don't *think* I saw my change reflected, but maybe you could tell me
if make snod should work, or if i need to do a full make.

But as another approach, I also wanted to ask this:  In the file
list_selector_background.xml located at frameworks/base/core/res/res/
drawable/, can I change the line:

item android:state_focused=true
android:drawable=@drawable/list_selector_background_focus /

to something that points to my resource, such as:

   item android:state_focused=true
android:drawable=@drawable/
com.mycompany.myapp.my_list_selector_background_focus /


Is there a way to do this?  thanks for your help.



On Sep 22, 6:47 pm, Dianne Hackborn hack...@android.com wrote:
 This happens for every application that is loaded -- the resources are a
 combination of the framework and application resources, and all of the
 framework can freely access the application resources.  This is generally
 accomplished by using a custom theme that references the app resources where
 desired.

 If you mean you want to install an app and have the framework magically load
 the app's resources and use something from it for all other apps, well of
 course you have the code and can do what you want.  It's certainly not
 atypical to load one app's resources into another app -- for example this is
 how home and other such things show icons or labels associated with other
 applications.  Context.createPackageContext() or the PackageManager API to
 get a package's resources are the typical mechanism for this.



 On Tue, Sep 22, 2009 at 5:59 PM, Andy Droid andydroi...@gmail.com wrote:

  Can a core class such as AbsListView access resources, such as xml
  files, and .png's, in a 3rd party app installed in the normal way (at
  the app level)?

  I realize this is a change in framework code, and that is fine for my
  purposes.  So, for example, if I know that I am going to install an
  app called MyApp, could I go into frameworks/base/core/java/android/
  widget/AbsListView.java and tell it to use an xml file and .png's that
  live in that app?  Here is the line I would want to modify:

  setSelector(getResources().getDrawable(

  com.android.internal.R.drawable.list_selector_background));

  thanks

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Can a core class access resources at the app layer?

2009-09-24 Thread Dianne Hackborn
Hi, let's move this discussion to android-porting, this is well outside the
scope of programming with the SDK.  (But no, you can't do that.)

On Thu, Sep 24, 2009 at 4:39 PM, Andy Droid andydroi...@gmail.com wrote:


 Thanks, Dianne.  I tested your suggestion with two apps, where one app
 gets resources from another app, and it worked.  Doing it at the
 framework layer is more difficult, but it may be more of a build
 problem.

 I made a change to frameworks/base/core/java/android/widget/
 AbsListView.java  did a mmm frameworks/base, and then make snod.
 I don't *think* I saw my change reflected, but maybe you could tell me
 if make snod should work, or if i need to do a full make.

 But as another approach, I also wanted to ask this:  In the file
 list_selector_background.xml located at frameworks/base/core/res/res/
 drawable/, can I change the line:

 item android:state_focused=true
android:drawable=@drawable/list_selector_background_focus /

 to something that points to my resource, such as:

   item android:state_focused=true
android:drawable=@drawable/
 com.mycompany.myapp.my_list_selector_background_focus /


 Is there a way to do this?  thanks for your help.



 On Sep 22, 6:47 pm, Dianne Hackborn hack...@android.com wrote:
  This happens for every application that is loaded -- the resources are a
  combination of the framework and application resources, and all of the
  framework can freely access the application resources.  This is generally
  accomplished by using a custom theme that references the app resources
 where
  desired.
 
  If you mean you want to install an app and have the framework magically
 load
  the app's resources and use something from it for all other apps, well of
  course you have the code and can do what you want.  It's certainly not
  atypical to load one app's resources into another app -- for example this
 is
  how home and other such things show icons or labels associated with other
  applications.  Context.createPackageContext() or the PackageManager API
 to
  get a package's resources are the typical mechanism for this.
 
 
 
  On Tue, Sep 22, 2009 at 5:59 PM, Andy Droid andydroi...@gmail.com
 wrote:
 
   Can a core class such as AbsListView access resources, such as xml
   files, and .png's, in a 3rd party app installed in the normal way (at
   the app level)?
 
   I realize this is a change in framework code, and that is fine for my
   purposes.  So, for example, if I know that I am going to install an
   app called MyApp, could I go into frameworks/base/core/java/android/
   widget/AbsListView.java and tell it to use an xml file and .png's that
   live in that app?  Here is the line I would want to modify:
 
   setSelector(getResources().getDrawable(
 
   com.android.internal.R.drawable.list_selector_background));
 
   thanks
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see
 and
  answer them.
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Can a core class access resources at the app layer?

2009-09-24 Thread Andy Droid

Whoops I thought this was android-platform, my bad. Anyway, yes I will
move it to android-porting.

On Sep 24, 4:48 pm, Dianne Hackborn hack...@android.com wrote:
 Hi, let's move this discussion to android-porting, this is well outside the
 scope of programming with the SDK.  (But no, you can't do that.)



 On Thu, Sep 24, 2009 at 4:39 PM, Andy Droid andydroi...@gmail.com wrote:

  Thanks, Dianne.  I tested your suggestion with two apps, where one app
  gets resources from another app, and it worked.  Doing it at the
  framework layer is more difficult, but it may be more of a build
  problem.

  I made a change to frameworks/base/core/java/android/widget/
  AbsListView.java  did a mmm frameworks/base, and then make snod.
  I don't *think* I saw my change reflected, but maybe you could tell me
  if make snod should work, or if i need to do a full make.

  But as another approach, I also wanted to ask this:  In the file
  list_selector_background.xml located at frameworks/base/core/res/res/
  drawable/, can I change the line:

  item android:state_focused=true
         android:drawable=@drawable/list_selector_background_focus /

  to something that points to my resource, such as:

    item android:state_focused=true
         android:drawable=@drawable/
  com.mycompany.myapp.my_list_selector_background_focus /

  Is there a way to do this?  thanks for your help.

  On Sep 22, 6:47 pm, Dianne Hackborn hack...@android.com wrote:
   This happens for every application that is loaded -- the resources are a
   combination of the framework and application resources, and all of the
   framework can freely access the application resources.  This is generally
   accomplished by using a custom theme that references the app resources
  where
   desired.

   If you mean you want to install an app and have the framework magically
  load
   the app's resources and use something from it for all other apps, well of
   course you have the code and can do what you want.  It's certainly not
   atypical to load one app's resources into another app -- for example this
  is
   how home and other such things show icons or labels associated with other
   applications.  Context.createPackageContext() or the PackageManager API
  to
   get a package's resources are the typical mechanism for this.

   On Tue, Sep 22, 2009 at 5:59 PM, Andy Droid andydroi...@gmail.com
  wrote:

Can a core class such as AbsListView access resources, such as xml
files, and .png's, in a 3rd party app installed in the normal way (at
the app level)?

I realize this is a change in framework code, and that is fine for my
purposes.  So, for example, if I know that I am going to install an
app called MyApp, could I go into frameworks/base/core/java/android/
widget/AbsListView.java and tell it to use an xml file and .png's that
live in that app?  Here is the line I would want to modify:

setSelector(getResources().getDrawable(

com.android.internal.R.drawable.list_selector_background));

thanks

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   Note: please don't send private questions to me, as I don't have time to
   provide private support, and so won't reply to such e-mails.  All such
   questions should be posted on public forums, where I and others can see
  and
   answer them.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---