Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Reads file inside a apk
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Cz  
View profile  
 More options Feb 16, 4:24 am
From: Mark Cz <ome...@gmail.com>
Date: Thu, 16 Feb 2012 01:24:17 -0800 (PST)
Local: Thurs, Feb 16 2012 4:24 am
Subject: Reads file inside a apk
Hi,
I am having an android application that is using an external jar that
has in addition to regular classes an html file.

The final apk root directory looks something like this

assests
res
AndroidManifest.xml
classes.dex
resources.arsc
helloworld.html

How can I access from my application to the last file
"helloworld.html"?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mulsaniya Bhadresh  
View profile  
 More options Feb 16, 4:38 am
From: Mulsaniya Bhadresh <bhadresh.ha...@gmail.com>
Date: Thu, 16 Feb 2012 01:38:14 -0800
Local: Thurs, Feb 16 2012 4:38 am
Subject: Re: [android-developers] Reads file inside a apk

hello , In the attached image whenever i am click on any cancel button
particular row will be deleted .But I am stuck here nothing happen only
item will rwmove from the list but it can't remove from the array adapter.
Can anyone help me so i can come out from this problem .I attached here my
code also

  finalorder.jpg
457K Download

  OrderActivity.java
9K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Murphy  
View profile  
 More options Feb 16, 8:22 am
From: Mark Murphy <mmur...@commonsware.com>
Date: Thu, 16 Feb 2012 08:22:31 -0500
Local: Thurs, Feb 16 2012 8:22 am
Subject: Re: [android-developers] Reads file inside a apk

You move it into assets/ and then use getResources().getAssets().open().

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

Warescription: Three Android Books, Plus Updates, One Low Price!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Cz  
View profile  
 More options Feb 16, 9:39 am
From: Mark Cz <ome...@gmail.com>
Date: Thu, 16 Feb 2012 06:39:44 -0800 (PST)
Local: Thurs, Feb 16 2012 9:39 am
Subject: Re: Reads file inside a apk
Thanks Mark.
But I don't want to use the assets directory, since it's not my
project. I am just giving the developers a jar with an html file
inside. Of course I can give them two files, a jar to put in their
classpath and a html file to put in their assets directory, but i want
to avoid that.
Anyhow I found a solution to read the file.
I am reading the apk file using
getPackageManager().getApplicationInfo(getPackageName(),
0).sourceDir;
And then by using java.util.zip.ZipFile I retrieve the html file, and
copy it to context.getFilesDir().getPath().

On Feb 16, 3:22 pm, Mark Murphy <mmur...@commonsware.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Murphy  
View profile  
 More options Feb 16, 9:46 am
From: Mark Murphy <mmur...@commonsware.com>
Date: Thu, 16 Feb 2012 09:46:14 -0500
Local: Thurs, Feb 16 2012 9:46 am
Subject: Re: [android-developers] Re: Reads file inside a apk

On Thu, Feb 16, 2012 at 9:39 AM, Mark Cz <ome...@gmail.com> wrote:
> But I don't want to use the assets directory, since it's not my
> project. I am just giving the developers a jar with an html file
> inside. Of course I can give them two files, a jar to put in their
> classpath and a html file to put in their assets directory, but i want
> to avoid that.
> Anyhow I found a solution to read the file.
> I am reading the apk file using
> getPackageManager().getApplicationInfo(getPackageName(),
> 0).sourceDir;
> And then by using java.util.zip.ZipFile I retrieve the html file, and
> copy it to context.getFilesDir().getPath().

Personally, I would not rely upon that long-term, though it may work today.

Once the ADT supports distributing Android library projects as JARs,
you could put the file in res/raw/ in your Android library project and
distribute it that way.

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

Warescription: Three Android Books, Plus Updates, One Low Price!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Feb 16, 4:18 pm
From: Dianne Hackborn <hack...@android.com>
Date: Thu, 16 Feb 2012 13:18:53 -0800
Local: Thurs, Feb 16 2012 4:18 pm
Subject: Re: [android-developers] Re: Reads file inside a apk

Please don't do that.  The correct way to retrieve the content of your .apk
is with Resources and AssetManager.

--
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Cz  
View profile  
 More options Feb 17, 8:50 am
From: Mark Cz <ome...@gmail.com>
Date: Fri, 17 Feb 2012 05:50:28 -0800 (PST)
Local: Fri, Feb 17 2012 8:50 am
Subject: Re: Reads file inside a apk
I would do that when the adt would support creating a library jar with
res/assets directory. I am sure many 3rd party developers will thank
Google for that.

On Feb 16, 11:18 pm, Dianne Hackborn <hack...@android.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »