通常我们在传递一个地址时如果有空格
String myString = "http://myhost.com/media/mp3s/9/Agenda of swine - 13. Persecution Ascension_ leave nothing standing.mp3"; 
URI myUri = new URI(myString);
结果会抛出异常
java.net.URISyntaxException: Illegal character in path at index X
其实很简单 只要把空格转换成别的字符就可以了
这里加设有空格的只在最后一个\ 后面
URI uri = new URI(string.replace(' ', '+')); 
或者
URI uri = new URI(string.replace(" ", "%20")); 
然后
int pos = string.lastIndexOf('/') + 1; 
URI uri = new URI(string.substring(0, pos) + URLEncoder.encode(string.substring(pos), "UTF-8"));2.
<application android:icon="@drawable/icon"  
    android:name=".SomeApp" 
    android:label="@string/app_name" android:debuggable="true"> 
if(Log.isLoggable(TAG, Log.DEBUG)) { 
    Log.d(TAG, "some log statement"); 
}3. 在一个服务中调试 有时候断电不能固定
 
os. Debug. waitForDebugger ( ) ;
 
public class SoftKeyboard extends InputMethodService 
        implements KeyboardView.OnKeyboardActionListener {
        
    @Override
        public void onConfigurationChanged(Configuration newConfig) {
        Log.d("SoftKeyboard", "onConfigurationChanged()");
 
        /* now let's wait until the debugger attaches */
        android.os.Debug.waitForDebugger();
        
        super.onConfigurationChanged(newConfig);
        
        /* do something useful... */
                
        } 










