android

ListView scroll to selected item

Hi, I have a ListView with an edit text and a button below it. When I click on a listView item the keyboard appears and push up the edit text and the button. I want the list to scroll to the selected item. Any idea? Thanks ...

services in android

can anybody give example with service in android? Thanks ...

Android EditText: Listeners, Newline Characters, and Focus

Currently I have an edittext field that when the user presses enter it does mostly what I want it to, validate an IP Address format and inform the user if it is wrong. How do I make it so when the user presses enter it checks it like it is supposed to be does NOT enter the newline character? Here is my code for it. public boolean ...

Passing A Bundle From A Running Thread To An Activity Launched By An Intent From Within It- Android

I have a running game thread (lets call it 'A') that will call a new activity to start from within it ('B'). The game thread object itself is declared and run from another activity 'C' though so how can I pass a Bundle from 'A' to 'B'? An intent is used in 'A' to launch 'B' but would a different method be applicable? I cannot just creat...

Android how do I get the position of a row in an ListView from an onClickHandler()

I have a view that has a custom ArrayAdapter as a ListAdapter. Customer is a Poco: public class Customer { public String LastName; public boolean IsActive; } What works: I have sucesfully bound my ArrayList to my ListView, the LastName is displayed as a text and the CheckBox is checked or not (depending on IsActive) but now I ...

Draw onto a ImageView

I studied the Androidreference for hours now, but don't really get the clue how to draw something (Text, Bitmap, Path ....) on a ImageView. Should I extend View and use the onDraw()-Method? If yes, how can I draw on my ImageView? Or is there any other way to achieve my goal? ...

Why does startActivity work in one method and fail in another?

I am an android beginner. I'm struggling to understand why startActivity runs properly when copied from a tutorial I found and fails when I make the smallest change. Code from the tutorial: private class ButtonHandler implements View.OnClickListener { public void onClick(View v) { handleButtonClick(); } } private ...

Storing a Bitmap into a ContentProvider from a BroadcastReciever ...

Hi all. I'm working on an app that, upon instillation of certain apps will send a message to them to register with a content provider. It all works fine, the strings are stored, but I can't get the byte[] blob (a bitmap .png file) to convert properly from within onRecieve() in the broadcastreciever. @Override public void onReceive(Cont...

Can I create custom global methods in my Android application class?

Hi all. I currently have an app that has many activities and needs to have a way of maintaining state between these activities. I use the Application class to do this, declaring my global variables and using getters and setters to interact with my activities. I was hoping to place a few custom methods in there, so that when I want t...

Android ListView 'flash' when row clicked is off

I have a list view that displays TextViews which have been spanned so that Links in the text are actionable. When a user clicks the row, not on a link, I'd like the row to 'flash' so that the user knows they have clicked it ok. I there a way to re-enable the row selected flash? ...

Using ArrayListAdapter with ListView

Hi guys I am using a custom ArrayAdapter in order to populate a ListView in my page. This is the initation code of that adapter: public IngredientListAdapter(Context context, int layout_resourceid, ArrayList<RecipeItem> items) { super(context, layout_resourceid); this.items = items ; ctx = context; } To this array adapter...

How to implement singleton with strategies?

I'm adapting Image Downloader from Google Android blog. I want ImageDownloader to be singleton since I'll be using it in multiple places in my application. I want also to be able to manipulate Bitmaps using different Strategies (eg. produce transparent bitmaps). Context: I want to be able to use ImageDownloader in one activity and set ...

Android and Flurry ExceptionHandler

This question is for people that has experience using flurry sdk in android applications. This sdk installs a custom exception handler. I am not satisfied with the detail of information that is logged by flurry and I would like to install my own ExceptionHandler while using flurry. Sadly the ExceptionHandler is unique per thread. Is ther...

Animation transition between activities using FLAG_ACTIVITY_CLEAR_TOP

Hey hey! In my android app, I'm making a method that pop all activities and bring up the first activity. I use this code: Intent intent = new Intent(this, MMConnection.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); this.startActivity(intent); As I noticed that the transition was still a left to right animation, does someon...

How to format an EditText's numeric value on unfocus (or at all!?) in Android to use commas

I'm trying to take the user input, which may or may not have a comma in it, and put a comma in the correct places upon the user deselecting the field (or at all, if that's not possible). I would also like to know how I can subtract the commas to make the number just an integer. Thanks in advance for your help! ...

Dealing with Thread, Handler and message: "Restart" a thread

Hi, public class Connection extends Activity implements Runnable { public static final int CONNECTION_ERROR = 1; public static final int CONNECTION_DONE = 3; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); createConnection(); ...

Self-contained test library project cannot find the library classes

According to this SDK guide, unit-testing a Library project can be achieved by creating a standard application project, reference the Library project and then instrument the application for unit testing. However, when I do this and launch the test application I get the message No tests found with test runner 'JUnit 3'. I'm using E...

ANDROID: Possible to load an Activity into a SlidingDrawer view?

I'm searching all over but cannot seem to find a answer to this. I have my main HomeActivity view which contains a SlidingDrawer in the main.xml layout. The sliding drawer works fine. What I'd like to do though is that when the SlidingDrawer is opened, I want to launch a new activity in the sliding drawer view, and when the drawer close...

How to read phone numbers with full (not only display name) contact data (first-name, last-name, nickname)? on Android

Hi I want to collect phone numbers from phone with last-name and first-name (for sorting purpose). How can I achieve that in the simplest way? Is it possible with one query? And I need both versions: for pre 2.0 SDK and later to be compatibile. ...

Socket leak in Apache Harmony SocketImpl on Android?

I have been working with dnsjava to do a lot of DNS lookups, using the Lookup class with its own resolver per lookup, and also with a single shared resolver. No matter how I invoke it, there are always collections of sockets left open at the end of the process, and eventually my process runs out of file descriptors and is killed. Tracin...