android-2.2-froyo

Double click event in android

本小妞迷上赌 提交于 2020-07-18 11:25:32
问题 How to implement double click event in android without using gesturedetector? 回答1: If you mean double tap you have to use GestureDetector.OnDoubleTapListener. 回答2: I'm sure all the code there does is determine if the second click was within a certain time of the first click, otherwise treat it as a second click. That's how I would do it anyway. 回答3: just use setOnTouchListener to record the first and second click time. If they are very close, determine it as a double click. Like this, public

Android SDK Media Recorder. State 4

两盒软妹~` 提交于 2020-02-23 05:37:50
问题 I'm just at the end of developing a quick Android App. Minor problem. What's state 4? I'm using MediaPlayer and every time I run the app I get an error stating that Media Player "start()" is first called in state 0, then state 4. Does anyone know what state 4 is? I can figure out the problem if I know the states such as state 1 and 2... Thanks, 回答1: This is from MediaPlayer.h in the Android source: enum media_player_states { MEDIA_PLAYER_STATE_ERROR = 0, MEDIA_PLAYER_IDLE = 1 << 0, MEDIA

Android SDK Media Recorder. State 4

醉酒当歌 提交于 2020-02-23 05:35:48
问题 I'm just at the end of developing a quick Android App. Minor problem. What's state 4? I'm using MediaPlayer and every time I run the app I get an error stating that Media Player "start()" is first called in state 0, then state 4. Does anyone know what state 4 is? I can figure out the problem if I know the states such as state 1 and 2... Thanks, 回答1: This is from MediaPlayer.h in the Android source: enum media_player_states { MEDIA_PLAYER_STATE_ERROR = 0, MEDIA_PLAYER_IDLE = 1 << 0, MEDIA

How to deal with OutOfMemory Exception

假如想象 提交于 2020-01-31 05:42:25
问题 I'm using Volley library in my project but I have problem with OutOfMemory Exception. In my application I'm downloading thumbs and full size images from server via NetworkImageView using setImageUrl method. I'm using BitmapLruCache: public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache { public static int getDefaultLruCacheSize() { final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); final int cacheSize = maxMemory / 8; return

How to deal with OutOfMemory Exception

谁说我不能喝 提交于 2020-01-31 05:42:05
问题 I'm using Volley library in my project but I have problem with OutOfMemory Exception. In my application I'm downloading thumbs and full size images from server via NetworkImageView using setImageUrl method. I'm using BitmapLruCache: public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache { public static int getDefaultLruCacheSize() { final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); final int cacheSize = maxMemory / 8; return

Global declaration of variable in android

浪子不回头ぞ 提交于 2020-01-22 15:26:47
问题 I am new to android development, I am parsing a xml file through SAX parser and storing the parsed data into a string.Now i need to use that string in another class, so i need to know how to call that parser in the new class. thanks in advance 回答1: I always make a class that contains all of my globals and call it "Constants.java" final public class Constants//final to prevent instantiation { public static final String SOME_STRING = "0.04"; public static final int SOME_NUMBER = 5; public

Global declaration of variable in android

一世执手 提交于 2020-01-22 15:26:09
问题 I am new to android development, I am parsing a xml file through SAX parser and storing the parsed data into a string.Now i need to use that string in another class, so i need to know how to call that parser in the new class. thanks in advance 回答1: I always make a class that contains all of my globals and call it "Constants.java" final public class Constants//final to prevent instantiation { public static final String SOME_STRING = "0.04"; public static final int SOME_NUMBER = 5; public

How to calculate distance using coordinates from LocationManager

谁都会走 提交于 2020-01-17 04:49:07
问题 I am using LocationManager to get the values of Latitude and Longitude of a user. These values are updated regularly to a database. Now, i want to find out the distance between two users basing on the stored Latitude and Longitude values. I want to display a message when distance between two users is less than (say 100 meters). Can anyone please guide me with a tutorial or some sample code of how to achieve it. 回答1: You can have a look at the Location class. You can set the longitude and

Font monospace Android 2.3

隐身守侯 提交于 2020-01-14 10:33:14
问题 I have a problem with a mobile website on Android Gingerbread and versions prior to this. Fonts monospace do not exactly behave as monospaces should: different characters have different widths. This is how it looks on a Gingerbread default web browser (I also tested on Dolphin and Opera mini): This is how it looks on a ICS default web browser: I used the Cultive Mono downloaded from the web. <link href='http://fonts.googleapis.com/css?family=Cutive+Mono' rel='stylesheet' type='text/css'> CSS:

Android ADB Not connecting to Droid 2

断了今生、忘了曾经 提交于 2020-01-14 06:50:08
问题 I am finding ADB extremely fuckle for my Droid 2. My computer is Windows 7 64bit and my Droid2 version is 2.3.4. I have googled and searched Stack Overflow and found many people have a similar problem. But mine is a weird twist on it. I can in fact connect my phone to my computer after a fresh install of ADB, however after I connect and run an app on it, the ADB connection dies and I cannot get it back. I have tried the following: Reinstalling the Android USB driver, editing the .INI file to