android

Isolating units and writing tests in Android

My project has the run-of-the-mill HTTP calls to fetch XML files, parsing the XML files, and creating domain objects. Those objects are later used in the actions and services of the Android app. I'd like to isolate that code. I also want to write tests for it. What are some good ways of doing this? Creating an Android Library doesn't s...

Anatomy of an Android Run Loop

I can't seem to find any documentation on the details of an Activity's run loop for Android. Apple documents the "anatomy of a run loop", and that's pretty much what I'm looking for. The Android documentation just says "Activity Is Running" in its life cycle state diagram. Obviously that's backed up by some sort of run loop. Anyone h...

passing array by calling activity from a thread

Hello I have two activities: "a" that spawns thread for generating a dynamic array of values inside public void run() function. "b", graphics activity that will help me draw rectangular pulses based on array values calculated in activity "a" (calculated in a's thread to be precise). When I am in thread inside "a", how do I pass val...

I want to start new Activity when i click on ListView's content

ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view,int position, long id) { Intent i = new Intent(this, contents.class); startActivityForResult(i, 1); But when i click on ListView ...

How can I make the android program display a layout and then wai a few sec. and the display another layout?

Hi guys I just want the program to display the layout main0 and stay for a few secounds then display layout main1 like the programs we see in any phone where an image or layout show up at the start of the program and then fade. /**the main activity */ public class rdwt extends Activity implements OnClickListener{ Button b1; Button b2;...

Landscape mode or no. That is the question.

In terms of usability, what are the best practices for going landscape mode with your application. I can see the need for both in some screens, but I can also see no reason for others. Providing a landscape view just because you can opens your application's UI to layout problems, shrinking views and headaches for designers. What's your...

Android - Padding in different phones

Say I add a linear layout with top padding of 20. Does it mean that the layout is rendered with 20 pixels of padding in all phones? Or does it scale according to the height/width/density of the phone? Thanks Chris ...

Tracking Android Market statistics

Hi, The developer console provides basic install statistics but does not provide any historical data or graphs. Many sites (androidzoom.com and many more) provide a view of the Market but they seem to be very out of date and generally provide much less granular data. Is there any way to access the data Google already has on my applicat...

Android - Nested layout question

Consider a VideoView added to a Linear Layout with parameteres FILL_PARENT, FILL_PARENT. The Linear Layout gets added to the root layout which is a Relative Layout, with parameters WRAP_CONTENT, WRAP_CONTENT. Which parameters take precedence here? ...

Use Layout as OverlayItem on MapView?

Is it possible to use a layout defined in XML as an OverlayItem to be added to a MapView instead of just a single drawable? I have several Overlays being drawn on the map but they are just single images, I would now like to place Overlays that are more complex objects instead of just a simple drawable. I am planning on drawing a marker...

What does lockCanvas mean (elaborate)

Hello! I'v been coming to drawing graphics in Android. There's a lot of sample applications out there, but one thing I always seeing is lockCanvas. Can someone explain it closer since I really don't get it and also because im think it's important to understand to future programming? An example: try { c = pa...

Android Linear Layout - Difference between weight and FILL_PARENT

According to documentaion, FILL_PARENT basically lets the view take up the entire extra space. Weight also dictates how much of the extra space can be taken by the view. What is the difference? For eg: What happens when I use, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f) ...

Android: How to shut down the Program completely?

Hello, I have a program with several activities. One can start activity B from clicking on a button in Activity A, and can start C from clicking on a button in B, and so on. In short A->B->C->D->E. If i click the button "Exit" in Activity E, i want to shut down my whole program, in another word, i want to finish all of the activities. H...

android getting contact first name

Hi I am trying to get a contacts first name. I know how to get a contacts full name, but I cannot figure out how obtain just the name. any ideas? Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)); String[] mPhoneNumberProjection = { PhoneLookup._ID, PhoneLookup.NUMBER, PhoneLookup.DISPLAY_NAME }; ...

Threshold for showing View in Android

I have a UI layout that's comprised of a single outer layout that contains three internal layouts. The internal layouts are essentially a header, body and footer. I would like to cause the top, header view to become completely hidden if it's forced to shrink past a certain threshold. It contains a logo image, and if it shrinks past a ...

Image fit screen in a WebView

Hello, In my app, I display pictures thanks to a webView. So for each image I create small HTML code that I load with the webView. So my html code consist basically in a img tag (with the path to my picture). My pictures have different sizes, that's why I'd like to set my webView zoom to fit the pictures width to the webView width. So t...

SoundPool not playing sounds

I made a SoundManager class that uses SoundPool functions in order to loop a specific sound, however I can't figure out why it isn't playing a sound. public class SoundManager { private SoundPool mSoundPool; private HashMap<Integer, Integer> mSoundPoolMap; private AudioManager mAudioManager; private Context mContext; public Soun...

Android BroadcastReceiver wait for Service to start or transmit WakeLock to Service?

BroadcastReceiver receives a broadcast, opens a wakelock, starts a Service Service opens another wakelock, then sends a "release wakelock" broadcast BroadcastReceiver receives the release wakelock broadcast and releases its wakelock Service does its thing and releases its wakelock There's a problem though. Currently the BroadcastRecei...

Jerky Scrolling when using SimpleCursorAdapter with ListView

Hi, I'm getting some very jerky scrolling while using the code below to create a ListView from a Cursor. Is there something I'm doing wrong, or any way to improve the performance of this ListView? bookmarksListView = (ListView)findViewById(R.id.bookmarks_listview); bookmarksDbCursor = bookmarkStore.getCur...

android support unicode?

will android OS support unicode ? ...