android

How to get the Android device's primary e-mail address

How do you get the Android's primary e-mail address (or a list of e-mail addresses)? It's my understanding that on OS 2.0+ there's support for multiple e-mail addresses, but below 2.0 you can only have one e-mail address per device. ...

Android Programming Tutorials: #6

I started working through the tutorials in Mark L Murphy's book "Android Programming Tutorials". In Tutorial #6, they are starting to work with tabs. I copied the code: TabHost.TabSpec spec=getTabHost().newTabSpec("tag1"); spec.setContent(R.id.restaurants); spec.setIndicator("List", getResources() .getDrawable(R.drawabl...

When does android first do layout?

I need to prepare some objects based on the initial layout of widgets and views in my Activity. I'd like to do it in the initialization steps, ideally onCreate and onStart. Considering the possibility of changes that happen when we're not in the foreground, some of them might need to happen in onResume. So I checked whether I could me...

search api question

Is it possible to make you app search a website with the search api for example typing something like 'i avatar' in the search widget to search imdb.com for the movie avatar? ...

How can I align image vertical center in a Linear Layout

Hi, I have the following layout, which is 1 icon on the left and 2 text views (stack on top of each other) on the right. I would like to have the text1 vertically center in the panel and when I make the text2 Visible.GONE. Can you please tell me how can i do that? <RelativeLayout android:id="@+id/panel" android:layout_width="...

thread join not working in Android?

I wrote code that can send http requests in parallel way with multiple threads. The parent thread uses thread.join() to wait for all child threads to finish. But in my code, join() didn't work sometimes. Could someone point out what's wrong with my code? Thanks. /** * @param urlSet * , a set of link URLs (Can not be null) ...

Trying to draw textured triangles on device fails, but the emulator works. Why?

I have a series of OpenGL-ES calls that properly render a triangle and texture it with alpha blending on the emulator (2.0.1). When I fire up the same code on an actual device (Droid 2.0.1), all I get are white squares. This suggests to me that the textures aren't loading, but I can't figure out why they aren't loading. All of my textur...

Matrix.setTranslate() only translates the visual surface of the View and not the clickable area?

I created a simple Animation-derived class and added an onclick listener to a view (a LinearLayout in this example, just to make a quick proof-of-concept) that called startAnimation on the object (passing it an instance of my class). In my Animation class, I simply get a reference to the Translation's Matrix object and call setTranslate...

How do I parameterize an Activity from within AndroidManifest.xml

I have a CustomListActivity which I wish to expose two facets of the same data. For example: I have a list of cars, and would like to list the set of colors, and the set of models. These would be filtered on mimetype from my ContentProvider: org.acme.cars.cursor.dir/colors org.acme.cars.cursor.dir/models My CustomListActivity is qui...

Android MediaStore insertVideo

So our app has the option to take either a picture or a video. If the user takes a picture, we can use the MediaStore.Images.Media.insertImage function to add the new image (via a filepath) to the phone's gallery and generate a content:// style URI. Is there a similar process for a captured video, given that we only have it's filepath? ...

Android persistent state with global variables when system kills activities

In order to persist state in my android app, so that the user will return to the activity they left off at, i've set the very useful flag alwaysRetainTaskState in my manifest: <activity android:name=".Main" android:label="@string/app_name" android:alwaysRetainTaskState="true"> <intent-filter> ...

How to create customized Views for AppWidgets?

There is a given set of predefinied Views that can be used in layouts for AppWidgets. How can a customized View added to this list? The minimum requirement is that the class is annotated with RemoteView. What else is necessary to be acceptable as view in the layout.xml? ...

In an android ListView, how can I iterate/manipulte all the child views, not just the visible ones?

The code below does NOT change the text of all of a ListView's rows because "getChildCount()" does not get all of a ListView's rows, but just the rows that are visible. for (int i = 0; i < listView.getChildCount(); i++) { View v = listView.getChildAt(i); TextView tx = (TextView) v.findViewById(R.id.mytext); tx.setTextSize...

Use Google apps in the emulator

Would it be possible to provide a emulator image that has all the Google apps that come with real devices, like Gmail etc? I don't have access to a 2.0 device which makes it close to impossible for me to develop/debug apps which uses AccountManager etc. ...

Is there a way to monitor and record which applications have started recently?

I would like to know which applications the user has started within the last, say, 24hours. Is this possible? ...

Using Android's `Timer.schedule` in Python

Could someone explain how to use the Timer.schedule - that is used for scheduling tasks - in Python? Note that Python's time.sleep will not work in Android. ...

How do I see which URL I was redirected to?

Hello, I'm trying to figure out which URL I was directed to. I'm using the following code and it seems to hide the redirect. HttpPost httpPost = new HttpPost(url); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httpPost); Thanks, Erik ...

Android Camera Intent Geo-Tagging

We are utilizing the Intent.ACTION_IMAGE_CAPTURE for taking a new picture from within our app. However, we would like to force geo-tagging of the pictures. Is there a way to set the intent to do this or does it rely solely on the default Camera app's setting to "Store Location"? (Also, it would be nice if this worked for the ACTION_VIDE...

android orientation change

while activity loading if user shake the handset my activity was crashign to fix this i added android:configChanges="keyboardHidden|orientation" to my activity, after that my activity stopped crashing and not calling oncreate again only changing then UI orientation, now i want to load images from drawable-land while orientation change...

how to display popup window in android??

dear friends, i want to display dialog/popup window of "are you sure you want to delete this entry" on click of button Delete if i press ok it should delete that entry other wise nothing.. i have written click listner of those buttons but dont know who to invoke dialog or pop and its functionality... any help would be appriciated. ...