Android :: Proper Way To Use Non Extended Classes?
Oct 7, 2010
I have an app I am working on and being new to Android Dev I am running into a situation. I have a Scores class not extended from anything (Activity,Service, etc) but in the same package that needs to access SharedPreferences
public class Scores {
Context ctcx;
public Scores(Context context) { ctcx = context;
}
View 4 Replies
Aug 16, 2010
I have seen 2 methods so far in my search, both of which I am having trouble with.
Method 1)
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 100);
Method 2)
IHardwareService hardware = IHardwareService.Stub.asInterface(ServiceManager.getService("hardware"));
hardware.setScreenBacklight(.5);
View 1 Replies
View Related
Dec 9, 2009
What is the proper way to set a timer in android in order to kick off a task (a function that I create which does not change the UI)? Or there is a better way in android (android's handler)?
View 2 Replies
View Related
Sep 13, 2010
Forgive me if this is a topic that has already been discussed, but I've searched for hours and can't seem to find the answer I'm looking for. I'm trying to cut my teeth on Android programming with a simple file manager app and currently have most all functions working, but I can't seem to open a selected file with the appropriate app.
Here is my current code:
CODE:..................
View 2 Replies
View Related
Mar 3, 2009
I want to re-use 1 adapter (similar to well known ImageAdapter from samples) with 2 different views - Gallery and GridView. I need to specify LayoutParams for the each View returned by getView() method of my adapter. In case of Gallery it should be instance of Gallery.LayoutParams, and in case of GridView it should be GridView.LayoutParams. I'll get an exception for sure if I'll try Gallery.LayoutParams with GridView and vice versa.What is the best way to do that? Can I somehow use "parent" parameter (ViewGroup parent) for that?
View 2 Replies
View Related
Mar 18, 2010
I have written an application and added 2 contacts on emulator, but i
am not able to update their names on android 2.1, code is working on
android 1.6 platform with the following code.
ContentValues contactValues = new ContentValues();
contactValues.put(Contacts.People.NAME, firstName+" "+lastName);
getContentResolver().update(UpdateContactUri, contactValues, null,
null);
In android 1.6 i am getting Uri for those two contacts are "content://
contacts/people/1" and "content://contacts/people/2".
but in 2.1 I am getting these values are "content://contacts/people/8"
and "content://contacts/people/9" and while updating its giving
"java.IllegalArgumentException, Empty values" exception.
When i tried to put a static Uri like "content://contacts/people/1",
code was debugged sucessfully but contact was not updated.
How can i resolve it, why i am not getting uri like 1.6 platform ?
View 3 Replies
View Related
Oct 29, 2010
I want to use the accessibility classes, but I'm a begginer in android programming and i can't understando how to use them. I don't find any example using these classes. Somebody can give me some use examples? Another thing Can I set enable the Accessility mode in the emulator?
View 2 Replies
View Related
May 18, 2009
I am writing a app, which has sort of plugin framework. public abstract class AbstractService {public abstract AbstractService getInstance(String name)..
View 2 Replies
View Related
May 29, 2009
I have an apk installed in /data/app. I want to use the class methods in there. Here is what I tried. code...
I got "ClassNotFoundException". By peeking into the apk, I don't see class files but classes.dex. I would assume SystemProperties class is in classes.dex. Why can I load it?
View 5 Replies
View Related
Jun 5, 2010
I'm having a bit of trouble getting videos to play on my HTC Evo with Android 2.1. I have several videos that I play on my PSP, and work just fine. However, when I transferred them over to my Evo's MicroSD card and tried to play them in any video player, they only played the audio stream, and no picture was shown. I never had trouble getting PSP-formatted videos to work on phones before; they worked n my G1 just fine. I assumed that because the Evo and PSP even had similar-sized screens, it would be even more compatible. It sounds somewhat foolish when I type it out, but one could expect it to work. I have tried playing it in the stock video player, the Meridian player, and the Video Player app from the android market, and they all had the same error. The file is an .mp4; and, as I said, gave me no problems when played in the PSP's video player.
Here's the specifications on the video file:
Type: MPEG4
Video Codec: AVC
Audio Codec: AAC
Size: 25 MB
Length: 00:23:41
Width: 480
Height: 272
Aspect Ratio: 16:9
Data Rate: 99kbps
Total Bitrate: 147 kbps
Frame Rate: 23 fps
View 6 Replies
View Related
Jan 11, 2010
the app I'm trying to implement allows the user to select a sound file (MP3 or WAV) to play at a specific date and time showing a dialog with a progress bar and an OK/Cancel button allowing the user to stop the playing of the sound file. I want it to behave something like the countdown apps I've seen or even the built-in alarm clock app. As I'm implementing this simple (I thought!) app, I'm trying to better understand the platform and make the application conform to the Android way.
As I've been writing the app, I learn more about how things are supposed to work on the Android platform. And here's where I'm getting a bit confused. During my attempts to get the alarm to fire and display, I'm learning that properly formed Android applications are not supposed to show dialogs as a result of a background service or broadcast receiver being invoked through Android's alarm service. Instead, I think, the app is supposed to use a notification on the status bar to alert the user. The user then has the option to look at the notification to see what the app is trying to tell them..............
View 1 Replies
View Related
Aug 28, 2010
I started to develope an application. When I wanted to close the application I clicked on the home screen, but the app is still playing in the background. Than I tried to click on the "back" key, but nothing happend, so I've created a key event listener for the 'back" key, and inside that method I wrote finish(); Now my app is closing but I think it's still running in the background, because when I go to "manage applications" I can still see it in the "running" tab, and if I press it, I see I can click on the "force close" to actually close the app. What do I need to do in order to really close the app without leaving it open (one way or another)?
View 9 Replies
View Related
Nov 22, 2010
Can finish() be used to close an activity from a service? If not, what is the proper way to end an activity from a Service? I've created an activity from my service and need to close it.
View 2 Replies
View Related
Feb 22, 2010
What is the best (most proper) location to install the Android SDK on Mac?
I've seen in some posts that somewhere in the Home directory is advantageous. Some seem to have placed the SDK in the Applications directory.
View 1 Replies
View Related
Apr 7, 2009
I am developing sample Video Recorder for Android.Following is My code snippet.
CODE:............
But when i am trying to run in eclipse,am getting following errors. MediaRecorder.VideoSource can't be resolved. MediaRecorder.VideoEncoder can't be resolved.
I am using android-sdk-windows-1.1_r1 as my android SDK,and didn update this from 1.0 instead i installed it freshly.
I guess there might be some problem with the SDK.
View 2 Replies
View Related
Mar 19, 2010
I am looking for the implementation of the IAlarmManager.I am interested in the scheduling done by the AlarmManager.setInexactRepeating method and so I started looking for the implementation but I haven't been able to find anything.Internally to AlarmManager, I can see that the actual work is being done by an android.app.IAlarmManager interface.After googling around for a bit there seems to reference to an implementing class called android.app.IAlarmManager.Stub but that is as far I get.I am working with Android 1.6.
View 1 Replies
View Related
Aug 30, 2010
I am trying to determine how to structure the code of a simple android game I am writing. I am focused on the UI portion. The behind the scenes portion (like a pause/restart/switching/etc) does not concern me. The Android demo games source code already do a great job with this. Essentially my game will need a UI with a series of objects on the screen (roughly 100 or 10x10) that the user can interact with. I need to supply an image for each object as well as implement the touch events and animation events for each object. What I am wondering is what type of class do I use for each object so that I can successfully implement these methods and how do I implement that particular class. Note that this game only executes on a user interaction with one of these objects, meaning I don't need a "real-time" implementation.....
View 2 Replies
View Related
Apr 19, 2010
I have read the Backward Compatibility Article, and I don't full understand how (or if I can) make a program backwards compatible if I want to use a class introduced in later versions. For example, I want to use WallpaperManager for apis 5+, but make the app as a whole compatible with api 3+. Is this possible?
View 14 Replies
View Related
Apr 28, 2010
Since i'm still new on Android programming, I have some problems on some issues. I have a QuadTree data structure implementation in 3 seperated Java files and i would like to use this data structure in my application. But i don't know how to use this .java files in an Android project. I tried to put them in a new Android project, just for testing, but I get lots of errors. Could anyone help me about using this java classes in my Application?
View 3 Replies
View Related
Apr 6, 2010
I have a class2 which is involved by class1 when clicks are made. I have to pass some parameters/objects from class1 to class2. I only know the standard way which does not have an option of passing parameters.
CODE:.................
View 1 Replies
View Related
Sep 26, 2010
How can I install java classes not included with android ?
Is it possible to add java.awt.image package into android?
Where can I find above package jar file?
View 5 Replies
View Related
Mar 15, 2010
This is a very weird problem. My app that runs just fine but somehow if I leave my phone for an hour or two while my app is running, I get the following error when I come back to it later:
CODE:................
I know for a fact that my yoga.database.Manager class was loaded at the time when the app was launched, but somehow the class must have been unloaded by the system as I left the phone.
Does Android unload classes automatically after certain periods? What can I do when my class gets unloaded? The above error causes my app to crash, but I can easily re-launch it and it runs just fine. The problem occurs mostly on my HTC Magic phone running Android 1.6.
View 2 Replies
View Related
Mar 19, 2010
I have a couple of third party classes which serve as a library I can build my application upon. They are contained in a folder which was added Java Build Path -> Libraries (in Eclipse) with "Add Class Folder". It works fine so far an my app compiles. But the produced .apk contains only my classes and therefore the application does not run. How can I tell Eclipse to package the third party classes into the .apk as well?
View 1 Replies
View Related
May 4, 2010
I have a bunch of objects that implement Serializable that I want to store in a SQL database.
I have two questions:
Is there a way to serialize the object directly into the database. Is that the best way to do it or should I Write the object out to a formatting String and put it in the database that way and then parse it back out
Write each member to the database with a field that is unique to each object.
View 3 Replies
View Related
Oct 14, 2010
I have a little idea of the Utility Classes with a slight doubt on demand.
If I use a Utility class in my Application than to use that class in my main Activity do I have to create the object of that class or I can directly Import that class in my main activity?
In the nutshell, all I want to be clear about is that basically how can I use the utility class in my Main Activity?
View 5 Replies
View Related
Nov 24, 2010
When calling javah on a .java file in my android project, javah was unable to find the android classes (specifically android.graphics.Bitmap).
Here's the terminal output:
CODE:..................
View 1 Replies
View Related
Jan 9, 2010
Any one know about In Android Widget Package how many Classes are there?
View 2 Replies
View Related
Sep 29, 2009
A static field which was initialized becomes null at some point. Can it be because that class was unloaded and loaded again?
View 3 Replies
View Related
Feb 16, 2010
I'm fairly new to Android and have gone through the basic tutorials. I thought I'd dig a little deeper and downloaded the source code to some of the "native" Android apps, like IM, Email, Voice Dialer, etc.
In importing the source of these native apps into Eclipse, I found that they reference classes that are not in the 2.1 API, i.e. classes such as android.content.Entity, android.net.http.DomainNameChecker, etc. As a result, I can't compile and play with this code.
So is there is a "hidden" API that the native apps use that is not available to the regular app developers? Is there a "native" SDK I can use to import these classes?
View 2 Replies
View Related
Jun 6, 2010
Before I delve into it, I'm very new to Android and I have just started learning Java last month. I've hit bumps while trying to develop my first simple app. Most of these hurdles were jumped thanks to random tutorials online. MY CODE IS VERY MESSY. Any tips are appreciated.
The question above is quite broad, but this is what I want to do: It's a essentially a blood alcohol content calculator / drink keeper-tracker. Basic layout: http://i.imgur.com/JGuh7.jpg
The buttons along the bottom are just regular buttons, not ImageButtons (had problems with that) Here's some example code ..
It outputs the following to the text view: "Your BAC is -0.017". This is the Bac value for if StandardDrinks was still 0, so obviously there is some problem communicating between the classes.
The other elements of the formula (weight, time spent drinking, and the alcohol %'s and such) are variables because I will ultimately allow the user to change those values in the settings.
I've heard around the water cooler that global variables are not good programming style, but this is the closest I've come to getting it to work..
View 2 Replies
View Related