After split array gives only first character
You need to escape the original special character:
Technical answers from my Stack Overflow history, with source links and licenses.
Showing 30 of 231 answers tagged android
Exported May 9, 2026
You need to escape the original special character:
Unless you are Chuck Norris or Jon Skeet, you shouldn't use RegEx to match HTML. I would suggest using Jsoup . Here is an example using the string from your question:
Change To The design library has the recycler view as a dependency. You also have a duplicate AppCompat. Make sure all support library versions are the same.
It looks like goBack(View) is most likely from an onClick setup in your layout XML. Since you aren't using the view, just pass null :
Add the following intent-filter to the relevant activity tag in your AndroidManifest : Add the following code in onCreate(Bundle) to check if the Activity was started from another app: Note: File managers might use...
Create a class where you can keep a strong reference to a Target . Full working example:
AppCompat resources can change in future updates. You should put a close button in your resources and use that drawable instead. If you want to make the current drawable white, then you can apply a ColorFilter ....
The app will be installed but a SecurityException will be thrown if you use a permission the system cannot grant. You can read more about permissions here: System Permissions | Android Developers
The constructor for BrowseAdapter calls the parent constructor ( see ArrayAdapter.java lines 154-164 ). The parent constructor creates a list of items ( see lines 175-182 ). Items are added to the adapter which adds...
On phone, will improve later. This should work:
I just decompiled KNOX Status . It looks like all the app is doing is getting the system property ro.boot.warranty_bit . I'm not sure if this still works and I don't have a Samsung at the moment to test. In terminal...
You can download the old ActionBar (Holo styled) icon pack that was on the official Android developer website here . This github repo also has the Holo styled icons.
You surpassed the 65k method limit in DEX. Earlier versions of Android build system report the error as follows: Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536 You can...
RootTools isn't the greatest. Personally, I suggest going with libsuperuser . There are plenty of reasons why your file isn't being deleting. If you look at RootTools, it doesn't add quotes around the path. So, if your...
As commented previously, android.os.FileUtils has changed and the solution posted by Ashraf no longer works. The following method should work on all versions of Android (although it does use reflection and if a...
Your code is compiled into a dex file inside your APK (classes.dex) and all resources are saved as a tree at the base of your APK. Because of this, ResourceBundle.getBundle(String) or...
This worked for me in a simple example I wrote: The code you are using should work for any MenuItem in the overflow, but does not work for MenuItem s that are always showing on the ActionBar .
You currently have two Toolbar layouts in your Activity. You need to set the Toolbar using setSuppotActionBar(Toolbar) . Example:
Are you sure you are using the same jar in both projects? Android's org.json.JSONObject.toString(String) is different: JSON.toString(Object) : In your case this would not throw an exception on Android.
Change the parameters of your AsyncTask to <Integer[], Void, String[]>
You should not be loading a WebView in a background thread; it needs to be loaded on the UI thread. I would add a listener to your WebView and when the URL is finished loading you can add your button.
In your RelativeLayout set android:clickable="true" . Or, a better approach would be to set an OnItemClickListener on your ListView .
Alex has a great answer. WARNING : Ugly code ahead I was able to get the signature in adb shell as root with the following code: indented:
You will need root access to do this from an app because ADB can access /system/bin/service but your app cannot (see GID of app and ADB). You should also check out third party libraries for handling su commands:...
You can use SystemBarTint or simply copy the static factory method below and call it in onCreate(Bundle savedInstanceState) in your Activity :
You can set the EdgeEffect color using reflection. The following will work from API 14+:
Here is a View.OnTouchListener that you can use to see if MotionEvent.ACTION_UP was sent while the user had his/her finger outside of the view:
You can get a random number between 6 and 10 like this: Here is an example to play a sound every 6 to 10 seconds: Just call playMySound(); in onCreate(Bundle) and toggle mKeepPlaying when you want to stop.
To answer your question, it is simply impossible to make your APK fully secure. XML files are easily parsed without apktool . I asked Ben Gruver/JesusFreke (the guy who developed smali) and he said it is impossible to...
Just because the app name is "2048" does not mean it is used in the package name. However, I looked up the most popular Google Play game and it does have 2048 in the package name. You could use grep to get the package....