I have a VideoView that takes up the top half of the Activity in portrait orientation with the bottom half of the screen showing some images and text. I am playing a rtsp video stream in the video view when the Activity starts. I have attached a MediaController to the VideoView via the following code:
MediaController controller = ...
I want to build a data structure in my application to store many entries indexed by keys. Each entry has several parameters to retrieve and update.
Could you suggest me which structure is most efficient among these following ones:
hashmap
SQL Lite
hashtable
others
Thanks in advance.
...
The following code produces a list with no entries:
AssetManager am = getContext().getAssets();
try {
String[] xmls = am.list("assets/images");
//Do something...
}
catch(IOException e)
{
}
There are plenty of files in my assets/images directory. What's wrong here?
...
Hi,
I am currently facing the following problem: whenever my Android application is started, it needs to execute some time consuming initialization code. Without this code all my activities/services within the application won't work correctly.
So far, I have put this initialization code into a SplashScreen activity, which I declared as...
I am using Environment.getExternalStorageDirectory() to create a file and I will need to know if there is enough space available before I create and store the file.
If you can cite the Android Ref doc, that would be helpful too.
...
Calling TextView.setTextSize is working abnormally. Right after the call to setTextSize if we get a getTextSize its returning a much higher value that what we set it to earlier.
Here's what we're doing:
zoomControl.setOnZoomInClickListener(new OnClickListener() {
public void onClick(View view) {
fl...
Hi,
I want to implement startForeground method in Service class for prevent service self kill.
Can anybody sent me code for implementing this method?
Thanks
...
In my Android app, when a user tries to transition from one activity to another, there may be some global state that indicates they need to complete some other action first.
To accomplish this, I've written a class with the following code:
private static WeakReference<Activity> oldActivityReference;
private static Intent waitingIntent;...
How do I delete SharedPreferences data for my application?
I'm creating an application that uses a lot of web services to sync data. For testing purposes I need to wipe out some SharedPreferences values when I restart the app.
...
I have a service setup to receive a PACKAGE_ADDED and a PACKAGE_REMOVED intent from all <data android:scheme="package" />
I receive the intent correctly, but I need to know how to use the Intent and Context classes from onReceive to get the name and label of the application that was added or removed.
I have been able to use Intent.getD...
I'm getting more and more requests about being able to use an App to SD feature that must be part of Android 2.2, but I really have no experience with it. I also don't know where to find any documentation regarding how to make my apps compatible with this feature. People have told me my apps cannot be moved to the SD card.
My mind is ...
Hi,
I am having problems with nine patch images ( **.9.png ). I have a widget layout and would like to use nine patch images for the widget's backgroud. Here is my background.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true" android:drawable=...
I see posts saying that FrameLayout is the alternative, and that I should use margins to position things (this strikes me as wildly counter intuitive, but ok... if it works, I'll take it). However, I can't get it to work, so, I'm looking for assistance.
here's my code
FrameLayout layout = new FrameLayout(this);
layout.setLayou...
I've an app that uses Android accounts - GoogleLoginService on (< 2.1) and AccountManager on 2.1 or greater. the app works fine on phones, but doesn't work on any of the emulators.
When I try adding accounts in emulator, it fails. In 1.6, option doesn't even exist.
Is there a workaround? I heard that there is a custom system.img that h...
Hi
In my thread I create an inner activity 'B' at one point in order to launch another activity for result. I need to declare this in my Android manifest file but can not work out what the name of it is as the standard ".B" does not work as it says that activity does not exist. How can I declare this activity?
Thanks
...
I am trying to change the locale programmatically on Android. The code I have below works fine on the Incredible(2.2) and Droid(2.2). However, it doesn't on the DroidX(2.1 Update 1)
Anyone here have encountered similar problem ?? Any insight would be helpful.
public void overrideLocale(String languageToLoad) {
Locale locale = new Loc...
I've been struggling with the runOnFirstFix() method for quite a long time. And maybe the problem is in that first line that says Running deferred on first fix.
The thing is, when the first fix gets executed and I am displaying some dialog in that moment, it crashes quite frequently.
I've extracted the following from the logcat:
I/Map...
I have two activities, activity 1 and activity 2 for example. Activity 1 will call activity 2 and send an arraylist which will then be modified. This I have already done using an intent. What I now want to do, is when activity 2 calls finish() I want that modified arraylist to be sent back to activity 1 so that it has the most upto date ...
I want to be able to automatically unpause my app when the user exits from the options menu. (unless, of course, they have selected pause...)
Handling it onOptionsMenuClosed works fine for the top level menu but is not called for a submenu. The higher level onPanelClosed does not appear to be called either.
I can detect when they enter...
I'm trying to create a "select-multiple" contact list where I can allow a user to check more than one contact. What I'm looking for is effectively the same thing as the native activity that appears when composing a message to multiple contacts. Thanks!
...