android-2.2-froyo

Android 2.2 - How do I detect if I am installed on the SDCard or not?

六月ゝ 毕业季﹏ 提交于 2019-12-21 04:05:05
问题 I am writing an android app that stores a lot of media files. They are not the type (and are far too many) to clutter up the users notification or other media directories, but they also must be user-updatable, so I can't put them in the resources. I can use getExternalFilesDir to get a path on the sdcard, but I only want to do that if the app itself is installed on the sdcard. If the app is installed internally, I want to put the media in the internal memory. So how can I determine if my app

Why is the ContentObserver called multiple times?

南笙酒味 提交于 2019-12-21 03:39:36
问题 I have following ContentObserver implementation for receiving and writing SMS, but it is called multiple times. Code: public class SMSObserverActivity extends Activity { protected MyContentObserver observer = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); String url = "content://mms-sms/"; Uri uri = Uri.parse(url); observer = new MyContentObserver(new Handler(

Check if all AsyncTasks have finished

家住魔仙堡 提交于 2019-12-20 11:30:58
问题 I have 3 AsyncTasks and 1 ProgressBar . I want when any of task executes, the progress bar is visible and when all of them finish, the progress bar is invisible. In Java, there is ExecutorService::isTerminated to check if all runnables finished but Android doesn't have it. Update: 3 tasks execute at the same time. Figure. 回答1: Nice graphic. But I am afraid there is no build in mechanism for this. You'll have to implement it by yourself. There are few solutions you could use - Keep a reference

Android Intent Action “ACTION_INSERT_OR_EDIT” - should it be used for adding contacts?

大城市里の小女人 提交于 2019-12-20 10:26:12
问题 At the moment I am searching for an easy and supported way of adding contacts in Android up from SDK level 7. (when some kind of data like the phone number is available) I looked at the default contact application and found "Intent.ACTION_INSERT_OR_EDIT" which is used for adding a new contact (or adding a number to a contact from the contact provider) from the dialer screen with the mime type "vnd.android.cursor.item/person". Now it would be nice to know how to find some documentation about

How to finish parent activity from child activity

戏子无情 提交于 2019-12-20 09:49:36
问题 I am new to Android development. I have created a main Activity (->A), which has 4 buttons. One of the 4 buttons is the EXIT-button. I start another activity (->B), on click of the EXIT-button. This opens 'B'Activity via an intent from 'A'Activity. Activity 'B' contains - Do you want to exit? Yes-Button & No-Button. If I give finish(), onclick of the button - it exits the 'B'Activity. I want to finish 'B' & 'A'. I have even tried A.finish() -> this doesn't get recognized and results in syntax

how do i get startActivityForResult() to bring up just a list of telephone contacts (like when i click on the “People” icon) using the android sdk?

半世苍凉 提交于 2019-12-20 05:47:15
问题 excuse me if this question is obvious, but I am new to android sdk. What I am trying to do is get a list of contacts that have real telephone numbers to send an sms message. I am deploying directly to my phone and trying to use just the contacts listed on my phone, but I am getting too many weird contacts. I would expect that when I call the startActivityForResult() method it will give me a list of phone contacts. What it seems to do is give me a list of all potential contacts and that seems

Which versions of Android SDK support coding in which versions of Java?

早过忘川 提交于 2019-12-19 16:55:46
问题 I was writing an Android app for Android SDK 2.3.3 but then I was asked to test it on a device running Android 2.2.1. So I set my target to 8 instead of 10. But then java.util.concurrent.TimeUnit only had the Java 1.5 feature set instead of the Java 1.6/1.7 feature set of java.util.concurrent.TimeUnit. So I put the openjdk 6 implementation of TimeUnit into my package for my Android app and everything works fine. Does anyone know where I can get some documentation that gives me a chart that

Which versions of Android SDK support coding in which versions of Java?

北城余情 提交于 2019-12-19 16:55:23
问题 I was writing an Android app for Android SDK 2.3.3 but then I was asked to test it on a device running Android 2.2.1. So I set my target to 8 instead of 10. But then java.util.concurrent.TimeUnit only had the Java 1.5 feature set instead of the Java 1.6/1.7 feature set of java.util.concurrent.TimeUnit. So I put the openjdk 6 implementation of TimeUnit into my package for my Android app and everything works fine. Does anyone know where I can get some documentation that gives me a chart that

Is there a documented way, in Android 2.x, to inspect multiple sd cards for content?

北战南征 提交于 2019-12-19 08:14:54
问题 Some Android 2.x tablets such as the HTC Flyer and Samsung Galaxy Tab support both internal tablet storage and an external SD card. For example on my Flyer, /sdcard and /sdcard2 are separate, with the former representing the tablet's "internal storage." If I use Environment.getExternalStorageDirectory() , there doesn't seem to be any set rule on which of those storage locations will be returned. In using getExternalStorageDirectory() , my concern is that I'll only find media stored on one of

Android 2.2 and “Bad address family” on Socket Connect

*爱你&永不变心* 提交于 2019-12-18 13:19:51
问题 I have a fairly simple game that works perfectly on every version now up through 2.1, but with the new 2.2 (Froyo) release I am unable to create a socket. I am using the mina package for nio, and get this exception: W/System.err( 263): java.net.SocketException: Bad address family W/System.err( 263): at org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native Method) W/System.err( 263): at org.apache.harmony.luni.platform.OSNetworkSystem.connect