好吧我試圖創建一個活動的鏈接,它的工作原理。然而passint它的變量沒有與#章程的工作:Android將變量傳遞給另一個活動,並且#不能按預期方式工作
String hashTagString = tempValues.getDescription().replaceAll("[#]+[A-Za-z0-9-_]+\\b", "<a href=\"sherif-activity://myactivity?tag=$0\">$0</a>");
Log.i(Utils.TAG, "hashTagString: " + hashTagString);
的推出活動:
String tag = getIntent().getData().getQueryParameter("tag");
Log.i(Utils.TAG, "tag: " + tag);
登錄貓:
02-24 13:12:04.293: I/PROJECTCARUSO(29591): hashTagString: Everyone loves <a href="sherif-activity://myactivity?tag=#hashtags">#hashtags</a> ! Take advantage of them by using them and clicking to search by them.
它啓動表明這一點的活動:
02-24 13:13:48.885: I/PROJECTCARUSO(29591): tag:
但是如果我硬編碼的值來設置它顯示:
02-24 13:14:41.176: I/PROJECTCARUSO(29883): hashTagString: Everyone loves <a href="sherif-activity://myactivity?tag=test">#hashtags</a> ! Take advantage of them by using them and clicking to search by them.
02-24 13:14:41.637: I/PROJECTCARUSO(29883): tag: test
我想通過整體價值,但如果我不能我怎麼能刪除所有特殊的字符?
無效的轉義序列(有效問卷是\ B \牛逼\ n \˚F\ r \」 \」 \\)當我與你 – jcaruso
替換我正則表達式日誌說'#hashtags'那麼你爲什麼會認爲它沒有正確評估它? – jcaruso
你是否像我說過的那樣逃脫它們? –