Android :: Combining Subclasses Which Have Different Fields For Efficiency?
Feb 7, 2010
I'm working on a Java Android game. Games here generally need to use memory pools to avoid garbage collection.Making use of subclasses is a pain when using memory pools as you need to e.g. say how many Roamer and Chaser objects you want upfront and not just how many Enemy objects you might need.I would then have an update function that checked the "type" variable and updated accordingly. This is obviously a more C-like approach. It feels hacky though because e.g. a roamer enemy will have a "target" variable it never uses. I'm unlikely to have more than a 100 enemies in memory at a time though so it really isn't a big deal memory wise. I just want some compromise between nice code and speed.Does anyone have any comments on how best to structure this? Is merging classes like this going too far? Is this ever a good idea? Should I just use a regular class tree?
View 4 Replies
Apr 27, 2010
Looking at various pages in the Android docs, some of them list "Known Indirect Subclasses". What does this mean?
View 1 Replies
View Related
Jan 15, 2010
Could someone explain the difference between a subclass and a constructor?
View 2 Replies
View Related
Apr 8, 2010
I'm working on a game for Android. To help implement it, my idea is to create a subclass of a view. I would then insert several instances of this class as children of the main view. Each instance would handle detecting when it was pressed (via OnTouchListener).
The problem I'm having now is how do I loop through all these sub-views so I can read their statuses and process them? (I.e. when they all reach a certain state something should happen). Or is there a better way to have several objects on the screen that respond to touch and whose status I can check?
View 2 Replies
View Related
Feb 19, 2010
I am using a custom adapter for my ListView as per the efficient adapter sample by Romain Guy. In the getView() method of my adapter I am assigning an ImageView a jpg image stored on SD using the following code...
View 2 Replies
View Related
Oct 14, 2010
I have heard that a processor without graphics card will take a lots of time to produce a graphical entity,than one with graphics card. So is there anything like that if we use Open Gl in android application?
will my application become slow?
View 1 Replies
View Related
Oct 26, 2010
My Question is, why do we create inner classes or subclasses in android. Like the following example ...
View 13 Replies
View Related
Mar 11, 2009
Greetings Developers,
I am just putting this question out there.
Is there a large efficiency difference between Canvas.drawBitmap or OpenGL. I am drawing using Canvas.drawBitmap and running slowing FPS, would openGL speed that up a lot you think?
View 7 Replies
View Related
Apr 29, 2010
I have two png image files that I would like my android app to combine programmatically into one png image file and am wondering if it is possible to do so? If so, what I would like to do is just overlay them on each other to create one file. The idea behind this is that I have a handful of png files, some with a portion of the image on the left with the rest transparent and the others with an image on the right and the rest transparent. And based on user input it will combine the two to make one file to display. (And I cant just display the two images side by side, they need to be one file). Is this possible to do programmatically in android and how so?
View 4 Replies
View Related
Apr 9, 2010
I'm wondering if it's possible to have an app that has a portion of its code implemented using Android 1.5 (API Level 3) and part using 1.6. (For example maybe implementing one of the app's activities in 1.6 while the overall app is in 1.5)?
View 3 Replies
View Related
Oct 7, 2009
I'm trying to have an image (as the background) on a button and add dynamically, depending on what's happening during run-time, some text above/over the image. If I use ImageButton I don't even have the possibility to add text. If I use Button I can add text but only define an image with android: drawableBottom and similar XML attributes as defined here.
However these attributes only combine text & image in x- and y-dimensions, meaning I can draw an image around my text, but not below/under my text (with the z-axis defined as coming out of the display). One idea would be to either extend Button or ImageButton and override the draw()-method. But with my current level of knowledge I don't really know how to do this (2D rendering). Maybe someone with more experience knows a solution or at least some pointers to start?
View 2 Replies
View Related
Sep 9, 2010
I've got a things to do with android, so, I have 2 images,
1. image from camera
2. another image from somewhere
So what I want to achieve is how to combine those image into 1 image, but it's overlapping (just like watermarking the image). The 2nd image should be scaled first into the size of the 1st image(camera) - so they have same dimension, then if the 2nd image pixel is black, don't combine it (so the black means transparent color - on 2nd image). Do you know what is the best way achieve this, can I do this with xor or bitwise?
View 2 Replies
View Related
Nov 24, 2009
I would like to know how I can create a chooser for the user to select from either a video or a photo. I want them to be able to capture a new video/photo or select from existing videos/photos. With the following code, I get a chooser that allows for that, but also allows audio creation/selection.
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(Intent.createChooser(intent, getString (R.string.mediaChooserTitle)), REQUEST_MEDIA);
If I set the type to "image/*" I can create/get a photo, and "video/* I can get/create a video. How can I combine these types?
View 2 Replies
View Related
Jul 30, 2010
The quick desk and bar control apps are so far my favourite. Previously I had my switches/toggles of WiFi/3g/gps/silent/bluetooth on the desktop. Now I have these switches in quickdesk. Thats not all - using the bar control app I can have any shortcuts in my slide down bar. So I just added the quickdesk app in my bar. The benefit is that I can now access my switches/toggles from anywhere.
For example if I am using my browser and forgot to switch on WiFi, while browser is open I just slide down the bar and through quick desk switch on WiFi. This means that I do not need to navigate away from the current app that is open. Normally you would have to minimize the current app open and navigate to desktop to toggle switches, then go back to the app you were using.
View 3 Replies
View Related
May 20, 2010
As part of the Android application I am developing in eclipse, I need to combine two packages from different projects into a single project. I tried copying the files in the package of the second project under the src folder of the first folder and copied other files required for second package into the res folder of the first project. But the auto-generated Java files i.e R.java doesn't get updated on copying. I tried right clicking on the project and clicking on Android Tools -> Fix Project Properties. But nothing changed.
View 2 Replies
View Related
Nov 23, 2009
Anyone who uses k9 Mail or have knowledge, I have a question. Is there a way to combine your email boxes to a global type inbox? Coming from a BB it was cool to be able to check 1 box to read all my 4 email account emails. Is this a feature available and I am missing it or is there an app for this?
View 3 Replies
View Related
Sep 23, 2009
Is there a way to manage the audio levels through an app? Or is it more dependent on the phone's built in capabilities? Right now at work I listen to a skype audio call from my house (for security) at a very low volume and then at a higher level I listen to music or podcasts, both sources going at the same time. When my dog goes nuts, the door is knocked on, or (in theory) if someone busted down my door, I notice the change in volume and sound, turn off my local media, and focus on what I'm hearing until the drama passes.
I ask because I would like to continue this setup when not at work, like say while running, where I again have earphones in and am normally listening to audio content. I would like to be able to have two pieces of audio: music combined with a skype stream or normal phone call, going at the same time like at work. So is there a way to have two sources going at the same time, with the volume of each independently adjustable? Is this an app thing or a phone thing? Phone will be Sprint Hero.
View 1 Replies
View Related
Jun 16, 2011
i am trying to combine two apk's in one..i write scripts using python for android.i can package those scripts in apk. however apk if installed on a phone which doesn't have python interpreter ask's user's to download interpretor.
what i want is one monolithic apk which contains python interpretor plus my script.
View 3 Replies
View Related
Jul 4, 2012
How to combine these multiple contacts into one? Galaxy Nexus
View 2 Replies
View Related
Dec 17, 2011
A widget which puts all the posts from the "big ones" in one, scrollable feed? I want Facebook, Twitter, Google+ and various RSS feeds in one big feed on one of my home screens, preferably with customizable colours.
View 2 Replies
View Related
Aug 3, 2009
I would like to how to use OverlayItem's fields (Title and snippet) 'cause they are never displayed on the map?
View 2 Replies
View Related
Jun 9, 2010
Alright, I'm a little new to the Android SDK, so forgive me if my question doesn't make sense or is very trivial. I'd like to add a custom field for contacts, that contains the contacts username on a website I'm doing this app for. And, with this custom field, I'd like to have the ability to click it (like "Send message" or "Call mobile") so that I can go to a specif Activity in my application, with a TextView set with the username that I just clicked on.Sorry if that is a bit confusing, if you need anything else let me know!
View 1 Replies
View Related
Jul 6, 2010
How do I make fields accessible across a package? Currently, even if they are declared public i'm not able to access the fields from another class in the same package.
View 2 Replies
View Related
Jun 29, 2010
I am new to writing Android Applications, and I need to be able to implement the following functionality. When a user clicks a specific button, I want a customized "prompt" box to appear, containing several fields (a textfield, a password field, and a checkbox field). I would also be nice if I could add an image inside this box. How would I go about implementing this sort of functionality?
View 2 Replies
View Related
Feb 3, 2010
I would like to use EditTextPreference to show 2 input fields instead of 1. For instance, a username and password field should be shown. I don't want to use a dialog for each one. How can this be done? In the WiFi settings there is one that does this, when you want connect to a protected network, a dialog shows to set a password for the credential storage with 2 fields.
View 1 Replies
View Related
Nov 1, 2010
I know rule #1 of optimization is: don't do it! But I figured this was an easy question, and if I start using the faster method now I can save a lot of cpu time when I'm finished.Now, the answer to my question may be "there's no difference" and that's fine with me. I just want to know.
View 4 Replies
View Related
May 20, 2010
In the following scenario, the fields of Activity is not released when the Activity is closed with calling finish().
Class MyClass {
}
View 3 Replies
View Related
Nov 4, 2010
I am creating my own app which will load a website upon starting. Now I want to auto-fill the fields that will appear on the website.Is this possible? How to I call the field through my app to fill up with pre-determined data?
View 5 Replies
View Related
Jan 25, 2010
Here http://source.android.com/submit-patches/code-style-guide#shortmethods it is stated that :
"Field Names
* Non-public, non-static field names start with m.
* Static field names start with s.
* Other fields start with a lower case letter.
* Public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.
also states that : "The rules below are not guidelines or recommendations, but strict rules. You may not disregard the rules we list below except as approved on a need-to-use basis." I don't like the "m" convention before private or package fields in a class... I really find this uninspired. I mean, if we try to apply good designs, the low coupling of the classes implies having few public fields. actually, in my programs I usually have no public fields, even when I need some I use getters and seters. so, why should I be forced to have almost all my fields in the program with an "m" in front of them? wouldn't be easier to have the few public fields, if there are any, with some "g" in front or something? or just use setters and geters as beans suggest? this really makes my code harder to read. also, following these guidelines, local temp variables used in the methods have no restriction so they could easily be mistaken for public global fields (also without restriction). this also I find to be wrong, as it is a probable source of mistakes. I understand to have a way of differentiating from fields, but private/protected member fields are the most used in an application, they shouldn't be less "readable". what do you think? should I follow the guidelines?
View 1 Replies
View Related
Oct 17, 2008
I noticed that currently GMail contacts does not have all the fields like birthday, anniversary, etc. like Outlook and my Palm Treo 755p. Does anyone know if this will be addressed? I hate the idea of "upgrading" my phone and losing functionality.
View 22 Replies
View Related