[Q] Editing an app - Java for Android App Development

Hello,
I'm editing an app using APKGUI, mostly to modify the look to conform more to holo style. I would, however, like to modify it a little. It is a messaging app and i want to put pictures of those who sent the message next to the message (line in hangouts) but I can't get it to work by editing the XML. Is there any way to do this through APKGUI modifications or not?
Thanks.

Nickcu13 said:
Hello,
I'm editing an app using APKGUI, mostly to modify the look to conform more to holo style. I would, however, like to modify it a little. It is a messaging app and i want to put pictures of those who sent the message next to the message (line in hangouts) but I can't get it to work by editing the XML. Is there any way to do this through APKGUI modifications or not?
Thanks.
Click to expand...
Click to collapse
depends on the app but I would suspect not as you would need code to resolve from a content provider to then populate the item (ImageView) in the row. So that would be in the adapter code powering the listView in the app

deanwray said:
depends on the app but I would suspect not as you would need code to resolve from a content provider to then populate the item (ImageView) in the row. So that would be in the adapter code powering the listView in the app
Click to expand...
Click to collapse
is there any way to get into the code?

Nickcu13 said:
is there any way to get into the code?
Click to expand...
Click to collapse
yeah if it's not too obfuscated when decompiled and you know how to query a content provider and load images, maybe not doing said actions on the ui thread but on another thread.. use smart messenger instead when I'm done you will be able to create a UI to your own needs </shamelessplug>

deanwray said:
yeah if it's not too obfuscated when decompiled and you know how to query a content provider and load images, maybe not doing said actions on the ui thread but on another thread.. use smart messenger instead when I'm done you will be able to create a UI to your own needs </shamelessplug>
Click to expand...
Click to collapse
basically all i need to do is get to the coding of one section where the profile image is displayed, and copy the query into the new section. but i don't know how to do that or where to find it in the decompiled part. It's not a normal messaging app, it's more of a people discovery app with messaging haha.

Nickcu13 said:
basically all i need to do is get to the coding of one section where the profile image is displayed, and copy the query into the new section. but i don't know how to do that or where to find it in the decompiled part. It's not a normal messaging app, it's more of a people discovery app with messaging haha.
Click to expand...
Click to collapse
it is not really a copy paste and work job Or that would be like, 0.0001% probability of working

deanwray said:
it is not really a copy paste and work job Or that would be like, 0.0001% probability of working
Click to expand...
Click to collapse
and why is that?

Nickcu13 said:
and why is that?
Click to expand...
Click to collapse
cause you would possibly need the following, get the contact id from the row from xxx variable/data, construct the now unique uri to pass to a content resolver to lookup the image uri and or path, then get an instance of the row imageView (or whatever view was going to hold the image) then pass that to a loader/async/new thread along with the uri for that then to load in the background, then check that when loaded the imageView instance is still the same (due to the way android recycles views) before setting it back on the main ui thread.
So a recap on the variable/s
imageView
contact id source (of that row)
the instance and data tracking in a thread
so these things are not something you can find in one app or even from the same app and "paste" into another section.
hope that, well, makes enough sense to know it's not a copy paste thing

deanwray said:
cause you would possibly need the following, get the contact id from the row from xxx variable/data, construct the now unique uri to pass to a content resolver to lookup the image uri and or path, then get an instance of the row imageView (or whatever view was going to hold the image) then pass that to a loader/async/new thread along with the uri for that then to load in the background, then check that when loaded the imageView instance is still the same (due to the way android recycles views) before setting it back on the main ui thread.
So a recap on the variable/s
imageView
contact id source (of that row)
the instance and data tracking in a thread
so these things are not something you can find in one app or even from the same app and "paste" into another section.
hope that, well, makes enough sense to know it's not a copy paste thing
Click to expand...
Click to collapse
so if it does all that once, all i need to to is copy and paste it, then change the variables to be unique.

Nickcu13 said:
so if it does all that once, all i need to to is copy and paste it, then change the variables to be unique.
Click to expand...
Click to collapse
well no, each one of those happens for every row, also you would have to "find" the data and instances to make it happen. example would be simply finding the resource ident (integer) for the imageView and grabbing an instance of it. findViewById(R.id.someIDofImageView) but then to avoid constant findViewById lookups on recycled views you would use a viewholder pattern, that then you would create a new object class that would hold this (cause lookups for the same ident on the same row many times when scrolling would not be great)... and more stuff, and thats just for the imageView instance part... clearer ?
I guess my point would be it's more involved that you perhaps think it is. Specially if you know little or no android/java

deanwray said:
I guess my point would be it's more involved that you perhaps think it is. Specially if you know little or no android/java
Click to expand...
Click to collapse
Another thing not to forget is the APK signature. If you unpack, edit and repack an APK you must sign it, othewise the installation will fail.

Related

App Developer Bidding

Is there a website where you post what you want and developers bid to do the work? I've used similar services before for html / php / java and was wondering if it was available for android apps???
sites like guru.com and rentacoder.com you may be able to find people.
Do you mind explaining the project"s" your looking at having done. Might find some people here who will be able to help and assist
I thought i saw something similar on www.anddev.org
Sluzpuppet said:
sites like guru.com and rentacoder.com you may be able to find people.
Do you mind explaining the project"s" your looking at having done. Might find some people here who will be able to help and assist
Click to expand...
Click to collapse
Here is my thought (remember, I'm not a developer):
A super basic app: a single icon (like wifi tether) that opens a predefined url that has users info appended to the end as arguments, see example below:
Code:
mydomain,com/page.php?name=mike&id=1234&color=blue
Users info are just text fields with no validation and are setup from the menu button.
This would be a customizable app. A person could modify the app by adding (changing) three files
icon image
url.xml - contains the base url and perhaps the app name
user.xml - contains the users data fields
above example users.xml would add 3 setup fields for name, id, color
by changing the url xml file, you could setup app to piont to any domain
by changing the users.xml, you could setup any number of arguments
by changing icon, app image would match users preference
Ideally it would be best if it could have multiple occurances of the app (maybe just app name being different would work) because I may want it for mydomain.com any you may want to use it for yourdomain.com
Hope this makes sense.

Store Item Finder / Item Locator

I'm trying to build an app for a school project that will locate items in a grocery store. For example, if I type in "orange juice" into the app, it will create a marker on a floorplan of the store. In this way I want to be able to populate a map with markers that correspond to items in a grocery list. Users can then walk around the store and swipe off markers as they pick up the items.
Does anyone know how I could do this? Are there any open source Android apps currently out there I could look at?
I feel like this would be a fairly simple project involving just uploading a .jpeg into an app and assigning coordinates to classes of items, like "juice" to {20,30} or something like that, but I have very little programming experience and am lost as to how to start.
bump
Well, people normally do not get an answer if they ask how to do the whole app.
So try to find the solution yourself and ask the community if you've got more specific questions/problems.
nikwen said:
Well, people normally do not get an answer if they ask how to do the whole app.
So try to find the solution yourself and ask the community if you've got more specific questions/problems.
Click to expand...
Click to collapse
Yeah I realize that I'm not going to get a step by step process... but I was just asking for general advice. Somebody suggested I use a .shp file and use an overlay with all the markers corresponding to the items, then create a pop up marker event for every time the user selects an item, which was helpful.
I'm looking for general ideas on implementation, that's all.
justinyeh said:
Yeah I realize that I'm not going to get a step by step process... but I was just asking for general advice. Somebody suggested I use a .shp file and use an overlay with all the markers corresponding to the items, then create a pop up marker event for every time the user selects an item, which was helpful.
I'm looking for general ideas on implementation, that's all.
Click to expand...
Click to collapse
You could save the name and the coordinates to files using JSON which can easily be written manually.
Have a look at Google's gson library.

[GUIDE] Using the Share Intent

Hello everyone,
While making an app, I wanted to let the user be able to share some content (shameless plug: from a clearable EditText). So, I looked up how to do this.
In this thread, I will share (pun not even intended) with you how to use the Share Intent yourself, so that your users can also quickly involve anyone they know in what they're doing.
There are some things that I am going to assume you've done:
- You have made your base app
- You have a Button done and set up, only needing a method to execute the Share Intent.
Now, let's get to it!
Step 1 - The method:
First, you have to set up the method. As always, give it a nice and descriptive name, so everyone (including you later, believe me that you'll need it) knows what it does.
Of course, this just follows standard syntax. I'm going to name it share, because simple!
So, you'll get this:
Code:
private void share() {
// This is the method where we share some content
}
Step 2 - The Intent:
You want to make sure that Android recognises your Intent as being a Share Intent. Of course, because of the flexibility of Intents, this is also easily done. Just declare another parameter, which isn't the usual set of Classes.
My Intent will be called shareIntent.
Like so:
Code:
Intent shareIntent = new Intent(android.content.intent.ACTION_SEND);
Step 3 - The type:
When sharing content in Android, you have to let the system know what you're sharing. Naturally, it has to react differently to different types of content. An image can be handled by certain apps, while others can only handle text. Apart from that, the apps have to process the items differently.
This is done by declaring the MIME type, which are unique identifiers for different data types.
Some possible types are text/plain, image/gif and video/mp4.
In this case, we are going to share some text. This is done by adding the following line under the Intent declaration:
Code:
shareIntent.setType("text/plain");
With the setType method, you could target specific apps. However, this is obviously not a good idea. If a user doesn't have that app on their phone, it'll cause trouble. Therefore, just use the right type and let the user select the relevant application.
Step 4 - The Content:
Now for the real work. What are you sharing? Of course, text! But you have to give the Intent that text, because it won't just snuff it out by itself.
How do we do this? Simple, again.
Just create a String and use that. Of course, you can hard code a String in the Intent, but it's best to use a variable. After all, you're probably going to be sharing dynamic content.
This is done as follows, though you should really know this by now:
Code:
String sharedString = "Hey, we are sharing!";
Step 5 - The extras:
You have to also give the Intent its extra information. For this example, we'll be setting two types of extras: a subject and the body.
This way, there is flexibility. If the user chooses to share the text using an email application, the subject will also be used. If they don't, it won't be used.
This is done by adding the following lines to your sharing method:
Code:
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "This is the subject");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, sharedString);
Step 5 - The Chooser:
Whenever you share something, you see the Dialog pop up for you to select the app you want to use in your sharing the content. This is the next and last step in this guide, and is basically just starting the Intent with a special parameter.
Not every type of media can be shared to every app. When you share certain content, Android looks at what apps have declared themselves candidates for that MIME type.
So, if you are not seeing certain apps appear, check whether the app can work with that MIME type!
Start the Intent like this:
Code:
startActivity(Intent.createChooser(shareIntent, "Share via"));
Of course, the title to the chooser doesn't have to be "Share via". It can be any other text or variable (keep this in mind for apps that have translations!).
Facebook doesn't do this right! The facebook app doesn't do sharing right, so it will probably not show up in the list of apps that you might see when following the tutorial. To counteract this, target the app using the specific API.
Have fun sharing, and thanks for reading!
P.S.: Images can be added, should anyone want me to do so.
I also found this for the ActionBar very interesting: http://developer.android.com/reference/android/support/v7/widget/ShareActionProvider.html
nikwen said:
I also found this for the ActionBar very interesting: http://developer.android.com/reference/android/support/v7/widget/ShareActionProvider.html
Click to expand...
Click to collapse
True, the ShareActionProvider is quite nice but has one really big downside: You have to update it with the Intent BEFORE the user clicks the item, and there is no workaround. So if you want to generate an image when the user clicks share, you cannot use the ShareActionProvider.
And thanks for the guide OP!
SimplicityApks said:
True, the ShareActionProvider is quite nice but has one really big downside: You have to update it with the Intent BEFORE the user clicks the item, and there is no workaround. So if you want to generate an image when the user clicks share, you cannot use the ShareActionProvider.
And thanks for the guide OP!
Click to expand...
Click to collapse
Wouldn't it be possible to extend the class? Maybe it could be achieved that way.
nikwen said:
Wouldn't it be possible to extend the class? Maybe it could be achieved that way.
Click to expand...
Click to collapse
Could work, but I have no idea what methods to override... I need to have a closer look at this.

Way to store Preferences

Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
GalaxyInABox said:
Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
Click to expand...
Click to collapse
Ah the data storage problem... I think we all came across this at least once . I suppose you read this guide on the different options available? Well there are actually three options: SharedPreferences, text or csv file and SQL.
The first one would need some work around and is probably the slowest. You would save a separate string directly into the SharedPreferences (maybe in a new file to avoid collisions?) with the array name and its index somehow in the key. That's just two methods of coding but not the nicest way to do it.
The text or csv file however is the more common way, here you'd save your array in one line of the file, each item separated with a ; or some other char. Needs a bit more coding and also the WRITE_EXTERNAL_STORAGE permission on preKitKat if I remember correctly.
The third one is the nicest and most modular one. Because it makes use of SQL it needs quite a bit of knowledge and some coding (but less than the text file).
I guess for simple things that you want to do it is better to stay away from SQL for now unless you know how to use it and use the SharedPreferences.
Edit: take a look at the answers to this question, they give you the code as well... And you can use StringSets in ICS and above if the order of your list doesn't matter !
I'd say go down the SQLite DB way, chances are that if you plan on expanding your coding knowledge and want to keep creating apps you'll be needing to learn this in the future anyway so why delay?
Google AndroidHive and look at their SQL tutorial - I used it when learning and found it very informative
Sent from my HTCSensation using Tapatalk
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
GalaxyInABox said:
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
Click to expand...
Click to collapse
Welcome
You mean you want to make your ArrayList, which is an instance variable in the activity, accessible to every other class within your package without having an instance of your activity at hands? Well the basic solution would be to make the ArrayList static. But that is not recommended because it won't be created and garbage collected at the same time as your activity and also it's not a nice way .
If you had an instance of the activity it would be just using a public getter for it, but without I'd put your ArrayList into a separate class following the Singleton pattern. That way you have only one global instance which contains the ArrayList.
Thanks again for your reply! I changed my mind about the ArrayList and created a method, where everything is stored in the SharedPreferences and the ArrayList's only purpose is the use with the ListView and Adapter. This way I don't have to write the ArrayList to the SharedPreferences and changes will be much easier to control. Although I had to implement another type of save/load method to interact with the class thats being loaded by xposed. That was needed because of the restriction that you can only load SharedPreferences with a context, which my class doesn't have. It's an inconvenient way, but it works

Intent filters

Ok so i used to be a very experienced actionscript user. But i recently wanted to get back into programming so im learning java now or rather trying to.
So im trying to understand the xml side of this so far and have some questions im hoping u guys can answer.
activities
So as i understand it an activity is a screen in an app. So for example the standard launcher on my phone has pages of apps on my main screens. Each one of those would be an activity? And then another activity for when i press the button to display all installed apps?
Have i understood that properly?
intent filters
This is where im getting confused. Ive googled it and read as much as i can find. As i read it, feel like someones explaining rocket science to a 5 year old.
The words component and instances is being thrown around enough that i got no clue whats even being said. What i have understood is it gives data to the activity.
So a best guess from my partwould be its telling it how the screens going to work or maybe like if theres going to be a button on it maybe. Or perhaps it means something different like just the properties sort of stuff like screen size or stuff of that nature.
As u guys can probably tell im confused beyond comprehension. I got no idea how good my grasp is of any of this. But if theres someone out there kind enough to dumb it down a bit so normal people can understand it. Id be very gratefull.
Bump
Bump
Hey,
unfortunately i cant answer your question. This is a part of android I don't understand too.
I think you should post your question again in the Question and Answer forum of XDA. http://forum.xda-developers.com/android/help maybe there is an developer who can help you.
Greetings
Thanks ill post there and see if it makes any difference
Android apps run in sandboxes. Consider a huge box partitioned into 'n' number of sections. Each partitions represent a place in android environment where app can reside. By sandboxing, app are given unique ID(UID) when they start a process. Only apps having same (UID) can access the app's resources so no malicious app can peek into the resources of other app.
If apps cannot see other resources, how could they communicate within apps? Thats where intent comes in. Intents are like post letters and android is the postman. You can either give:
1. Recipient address, here, the package name of the app for which the intent is to be sent and may include your data in the intent if there is any and the postman (android) delivers it to the right person (target app). This is also known as explicit intent because you know the target class to call
2. Intent filter - This is not as specific as the first one. Here, your app has to perform something using an external app but your app doesnt know of the other apps which could perform the action. So, this time it will go for a broadcast and say "Hey! I need to take a picture! All camera apps please come in" and the broadcast is sent by android which displays list of apps which respond to this broadcast. When the user chooses the app to perform the action, the app fires, performs the task for your app, return the data to your app in form of intent result.
To register an app to respond to this type of intent, the app specifies something called intent-filter in their manifest which says the android, in our example context "I can perform camera action". So next time intent for camera action is sent, the app is in the list of apps to perform action with. This type of intent in implicit intent as you let the android and user decide the app. You can also specify your own custom intent-filters apart from standard android ones.
vijai2011 said:
Android apps run in sandboxes. Consider a huge box partitioned into 'n' number of sections. Each partitions represent a place in android environment where app can reside. By sandboxing, app are given unique ID(UID) when they start a process. Only apps having same (UID) can access the app's resources so no malicious app can peek into the resources of other app.
If apps cannot see other resources, how could they communicate within apps? Thats where intent comes in. Intents are like post letters and android is the postman. You can either give:
1. Recipient address, here, the package name of the app for which the intent is to be sent and may include your data in the intent if there is any and the postman (android) delivers it to the right person (target app). This is also known as explicit intent because you know the target class to call
2. Intent filter - This is not as specific as the first one. Here, your app has to perform something using an external app but your app doesnt know of the other apps which could perform the action. So, this time it will go for a broadcast and say "Hey! I need to take a picture! All camera apps please come in" and the broadcast is sent by android which displays list of apps which respond to this broadcast. When the user chooses the app to perform the action, the app fires, performs the task for your app, return the data to your app in form of intent result.
To register an app to respond to this type of intent, the app specifies something called intent-filter in their manifest which says the android, in our example context "I can perform camera action". So next time intent for camera action is sent, the app is in the list of apps to perform action with. This type of intent in implicit intent as you let the android and user decide the app. You can also specify your own custom intent-filters apart from standard android ones.
Click to expand...
Click to collapse
Gave u a thanks fkr that very useful responce. Thank you. So if ive understood this right. If i want to take a picture for example the intent filter part basically calls out for an external app to perform the action. With intent filter so basically when an app asks u with that menu what app youd like to choose thats an intent filter? And implicent thats the same menu or android just chooses it for you? Im trying to picture it from the user-side
Recipient address seems straight forward. You know u need an app and what its called. So u dont even need the user to select anything.
scorpafied said:
Gave u a thanks fkr that very useful responce. Thank you. So if ive understood this right. If i want to take a picture for example the intent filter part basically calls out for an external app to perform the action. With intent filter so basically when an app asks u with that menu what app youd like to choose thats an intent filter? And implicent thats the same menu or android just chooses it for you? Im trying to picture it from the user-side
Recipient address seems straight forward. You know u need an app and what its called. So u dont even need the user to select anything.
Click to expand...
Click to collapse
Your understanding on implicit intent is correct. To make it even more short an precise,
An intent is an abstract definition of the operation to be performed by the app
Click to expand...
Click to collapse
When the target action is known, say you invoke a second activity of you app. You know the target action (the class name), that is your implicit intent. You decide what action to perform without user intervention here. Explicit usually needs user input for inter-app communication to take place.
Examples of few implicit intents:
Starting an activity
Starting a service
vijai2011 said:
Your understanding on implicit intent is correct. To make it even more short an precise,
When the target action is known, say you invoke a second activity of you app. You know the target action (the class name), that is your implicit intent. You decide what action to perform without user intervention here. Explicit usually needs user input for inter-app communication to take place.
Examples of few implicit intents:
Starting an activity
Starting a service
Click to expand...
Click to collapse
Ok cool. So recipient is when we choose the app. Intent is whwn they get a menu to choose it. And implicent is is when android chooses it for them.
Sounds simple enough. Thanks for all the help buddy
And would i be right in assuming that the actions we put in intent filters and the others in form it of stuff like when its triggered, how often and so forth?

Categories

Resources