Can a core class access resources at the app layer?

by Andy Droid » Wed, 23 Sep 2009 09:00:02 GMT


Sponsored Links
 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



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



Can a core class access resources at the app layer?

by Andy Droid » Thu, 24 Sep 2009 05:47:04 GMT


 That's a great tip, I hadn't know about that.  But, I'm trying to make
it so that the default list selector will be changeable, at the app
layer.



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


Sponsored Links


Can a core class access resources at the app layer?

by Andy Droid » Fri, 25 Sep 2009 07:40:46 GMT


 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.






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



Can a core class access resources at the app layer?

by Andy Droid » Fri, 25 Sep 2009 07:59:11 GMT


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

On Sep 24, 4:48pm, Dianne Hackborn <hack...@android.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Honeycomb emulator on Linux

Hi,

Anyone managed to get the emulator to run on Linux?

For me it gets stuck on '/dev/dsp no such device' or
'/dev/dsp: Device or resource busy' if I install OSS emulation.

The '-noaudo' and '-audo none' options seem to be ignored, and
'-audio alsa' doesn't make a difference either.

I'm using Fedora 14 x86_64.

-- 

2. Android 2.3 problem with startAnimation in onCreate or onStart methods

Hi,
We have a game working well in 2.1 and 2.2 versions of android (RuniK). We 
were ready to release a new version when we received a mail from a user 
using the 2.3 version to report a problem.

In the onCreate method of my GameActivity, I create a matrix of initially 
hidden views then start an animation on each view. The workflow of the game 
goes on after all onAnimationEnd methods are called. But in the 2.3 version, 
the onAnimationEnd is never called and the game is stuck with empty 
screen. If I go back to the main android screen using the home button then 
switch back to the game, the onAnimationEnd methods are called and the game 
can start.

I though the lifecycle had changed in the 2.3 version and that the starting 
of the animations should be done in the onStart method (which requires some 
heavy code modifications to be sure a game isn't started again when 
switching back) so I tried a quick test. But it didn't change anything.

I'm pretty stuck right now so we'll release a new version without the 
support for 2.3 android based devices.
Is this problem known ? If you have an idea, it'll be welcomed.

Regards,
Florian

-- 

3. VPN Manager Interfaces

4. PrivacyAppCamp in Mountain View 10 Feb 2011

5. About Encryption in Android 3.0 (Honeycomb)

6. Android release process

7. Boot on power: power on when plug in USB