How i can create usable android project's library

by Ali Adnan » Wed, 12 Aug 2009 23:10:25 GMT


Sponsored Links
 How i can create android project's library that can be used in any
different project.

Problem:
I create a jar file that contains all activities and add this jar file
into my eclipse project build path. But if i need to use any activity
then i must need to register this jar activity into my project
AndroidManifest.xml. This looks very odd. I need a solution in which i
have a jar or any other deployable file that contains multiple
activities and any user can use them in his project without
registering these jar activities into NEW android application
AndroidManifest.xml file.

Ali Adnan.

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



How i can create usable android project's library

by Mark Murphy » Wed, 12 Aug 2009 23:13:10 GMT


 


That is not possible.

As I wrote 5 hours ago:

Bear in mind also that your library cannot package any resources, making
activities that much more difficult to package in a library.

You can see a library that I package with an activity here:

https://github.com/commonsguy/cwac-custmenu/tree

Anyone using this library will need to both list my MenuCustomizer
activity in their manifest, but also pass in a couple of resource IDs by
integer extras on the launching Intent, to get around the fact that
MenuCustomizer cannot have its own resources.

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

Android Development Wiki:  http://wiki.andmob.org 

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


Sponsored Links


How i can create usable android project's library

by kostmo » Thu, 10 Sep 2009 07:22:54 GMT


 > Bear in mind also that your library cannot package any resources, making

I'm not sure that is true.

I have created a .jar from a project that happens to include some
layout files.  I import this .jar from a second project, and add a few
lines to the second project's Manifest file:

    <activity
android:name="com.googlecode.chartdroid.ChartPanelActivity"
android:theme="@android:style/Theme.Translucent">
        <action
android:name="com.googlecode.chartdroid.intent.action.PLOT" />
        <category android:name="android.intent.category.DEFAULT" />
    </activity>

When I launch the .jar'd activity from the second activity with an
implicit intent, it appears to work fine.  The layout resources that
the .jar'd activity uses exist only within the .jar file.
--~--~---------~--~----~------------~-------~--~----~



How i can create usable android project's library

by Mark Murphy » Thu, 10 Sep 2009 07:33:53 GMT


 


*blink, blink*

How do you have the resources packaged in the JAR?

Thanks!

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

_Android Programming Tutorials_ Version 1.0 In Print!

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



How i can create usable android project's library

by kostmo » Thu, 10 Sep 2009 08:42:02 GMT


 Oops, I'll have to retract that; my test was invalid.  The manifest
lines I added were incorrect (forgot the <intent-filter> tags),
causing my new version not to be installed...

I do indeed find problems in my log now, such as:
09-09 19:28:11.484: WARN/ResourceType(580): No package identifier when
getting value for resource number 0x7f060000

-and-

09-09 19:29:18.184: ERROR/AndroidRuntime(3002): Caused by:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list'

followed by F/C.

Sorry for the mix-up!

I was also misled by the fact that I could reference the ID's of the
resources inside the JAR, suggested by Eclipse's autocomplete
behavior.

I think the best way to accomplish what I was intending will be to
install an entirely separate .apk with the libraries.

Karl





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



Other Threads

1. Is anyone else getting bored of announced product releases that don't materialise ...

Its not the device pr that matters.. its the Mobile Operators  that sign up
that matters as far as growth

I know of two Mobile Operator Announcements coming ..





On Mon, Apr 27, 2009 at 9:19 AM, admin.androidsl...@googlemail.com <




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

2. cupcake 1.5 r1 surfaceCreated is not called!!!

I've created game,
everything works fine on all previous android versions except current
cupcake 1.5.
It works even on cupcake pre release.I'm using exact the same
build.xml, sources and resources.
The problem is that surfaceCreated is not called :
                SurfaceHolder mSurfaceHolder = getHolder();
                mSurfaceHolder.addCallback(this);
                setFocusable(true);

                waitForScreen(); - here I untill surfaceCreated change variable 
that
it's ready,but it's never called.
I just can explain that I'm running SurfaceView activity after
stopping regular View activity (for the game menu - it was easier to
create it).

 Please help me if you can figure out something. I'm just a developer
not a Android engine tester. If they are putting such stuff to the
market they should test it a little bit (not talking about discovered
VM crashes instead of exceptions).

AA


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

3. TabHost launching Intent multiple times

4. HTC Magic release in Spain, with apps on SD?

5. Boxbe cra

6. Not able to play video from the network URL

7. Application Not Responding (ANR) dialog