Different drawable source folder

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Different drawable source folder

Postby blackgin » Mon Sep 28, 2009 5:15 pm

How can I define a different folder where I store drawables for the app?
Is it possilble in layout.xml or il Activity.java?
For example I want to load an image from a sd folder, how could I do?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Top

Postby nmc » Mon Sep 28, 2009 6:56 pm

Just search the forum
nmc
Senior Developer
Senior Developer
 
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany

Postby blackgin » Mon Sep 28, 2009 8:32 pm

I already searched, but it wasn't so easy to find it, in fact I didn't found it.
However using that code, how could I change analogclock hands?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby nmc » Mon Sep 28, 2009 10:40 pm

However using that code, how could I change analogclock hands?

What does this question has to do with
How can I define a different folder where I store drawables for the app?
For example I want to load an image from a sd folder, how could I do?

You plan to use images for every minute-position of your clock?
nmc
Senior Developer
Senior Developer
 
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany

Postby blackgin » Tue Sep 29, 2009 8:24 am

No, I need to make my clock skinnable.
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby nmc » Tue Sep 29, 2009 9:52 am

Then your question is how to use an image from sd instead of the original from res/drawable?

The link provided in my first post shows how to load the image and how to use it for an ImageView.
nmc
Senior Developer
Senior Developer
 
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany

Top

Postby blackgin » Wed Sep 30, 2009 9:08 am

Yes but now my question is different.
Does someone knows how to change AnalogClocks hands?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby blackgin » Wed Sep 30, 2009 6:02 pm

Nobody? I don't know where to search if nobody answers me here :(
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby azraeal » Wed Sep 30, 2009 6:49 pm

I'll add 2 + 2 for you:

nmc:
The link provided in my first post shows how to load the image and how to use it for an ImageView.


Now that you can reference any drawable from the SD card, you have to define your structure.

Example: all my skins are stored in /sdcard/myapp/skins
each file must have a file name starting with myapp_skin

Now that that's out of the way, in our program, we reference /sdcard/myapp/skin directory and grab a list of all files stored there. Then based on what we get, we put those files as the drawable resources.

You get each of your images as a File, then generate an InputStream from that file. Finally, you can use either BitmapFactory or Drawable to create the Bitmap/Drawable, whichever you're more comfortable with.
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Postby blackgin » Wed Sep 30, 2009 6:54 pm

Yes but I can't find the method to change hand. I know that pictures must be the arguments, but which method must I use?
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Postby azraeal » Wed Sep 30, 2009 7:08 pm

I'm assuming you're using http://developer.android.com/reference/ ... Clock.html

The current framework doesn't allow easy skinning. The current approach would be to override the onDraw() method and just recreate how it's drawn. But that's lacking because you'd have to re-implement how you actually GET the time as well. The lack of documentation also doesn't help.

Due to those limitations, it makes skinning internal apps/widgets much more complicated. However, if you're skinning your OWN app/widget, the previous process is ideal.
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests