How to save, retrieve and remove in android using SharedPreferences

Interface for accessing and modifying preference data returned by getSharedPreferences(String, int). For any particular set of preferences, there is a single instance of this class that all clients share. Modifications to the preferences must go through an SharedPreferences.Editor object to ensure the preference values remain in a consistent state and control when they are committed...

Auto Realizable or Auto Fit TextView in android or android studio

Displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; see EditText for a subclass that configures the text view for editing. Sometimes, we need auto fit textview, as required input...

ERROR: In MenuView, unable to find attribute android:preserveIconSpacing in Android

Are you struggling with ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing in Android using eclipse , this error comes in R.Java files, you clearly see on you project, then don't worry , we have solution for this error. Steps: 1. Right Click on Project 2. Go to Properties 3. Choose Android 4. Change Below API version then previous(eg. if 5.1.1...

Dynamic add and remove item on listview in android or android studio

Progammatically add new item and delete existing item on listview, basically apply in when you add item on cart, when making to do list, or any thing important date, person, books, location add or delete of your own list. First you have to create layout file(activity_main.xml): <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"...

Convert Dp to Px and Px to Dp in Android or Android Studio

In Android documentation , dp( Density-independent Pixels) - An abstract unit that is based on the physical density of the screen.These units are relative to a 160 dpi (dots per inch) screen, on which 1dp is roughly equal to 1px. When running on a higher density screen, the number of pixels used to draw 1dp is scaled up by a factor appropriate for the screen's dpi. px(Pixels) - Corresponds to actual...

Android N Developer Preview release

Android N Developer Preview, a program that gives you everything you need to test and optimize your apps for the next version of Android. It's free, and you can get started right away just by downloading the N Developer Preview tools.    The N Developer Preview runs from 9 March...

Error parsing data org.json.JSONException: Expected ':' after n in Android or Android Studio

Last time, i got error when trying to parse a JSONObject , then i have found simple mistake during parsing. It's because i append an "n" at the end of each line here:         while((line = reader.readLine()) != null) {             sb.append(line + "n");         } then I change to a newline character "\n":     while((line...

Load Image From Web url in Android or Android Studio

Here, is the tutorial for image url in to the your mobile app. There are two method, you can choose as your requirement ,  Aquey or direct image load, 1. Image load using direct url First you have defined , imageview and then load image url in that imageview. private Bitmap bitmapImage; private ImageView imageView; private ProgressDialog pdDialog; private String imageUrl=""https://www.....png"; In...

Scan or read for wireless networks in Android WiFi

This class provides the primary API for managing all aspects of Wi-Fi connectivity. Get an instance of this class by calling Context.getSystemService(Context.WIFI_SERVICE). It deals with several categories of items: The list of configured networks. The list can be viewed and updated, and attributes of individual entries can be modified. The currently active Wi-Fi network, if any. Connectivity...

Download Samsung Galaxy S2 USB driver for Android

For Android development on real device like Samsung Galaxy S2, you need to install Samsung OEM driver or USB driver. This Android OEM driver documentation will guide you where to download it… but the guide is not easy to follow. Actually, the “Samsung USB driver” is included in the software called...

Solution: INSTALL_FAILED_INSUFFICIENT_STORAGE error in Android or Android Studio

Update Nov 2024The INSTALL_FAILED_INSUFFICIENT_STORAGE error in Android or Android Studio typically occurs when your device or emulator runs out of available storage space to install the app. This can happen on both physical devices and Android emulators.Common Causes:Device/Emulator Storage Full: If there is not enough free storage space on the device or emulator, this error will occur.Check the...

Setting up the Android Studio Proxy

To support running Android Studio behind a firewall, set the proxy settings for the Android Studio IDE and the SDK Manager. Use the Android Studio IDE HTTP Proxy settings page to set the HTTP proxy settings for Android Studio. The SDK Manager has a separate HTTP Proxy settings page. Android Studio supports HTTP proxy settings so you can run Android Studio behind a firewall or secure network. To set...

Java Functional Programming: Understanding Predicates

As java 8 introduces the predicate functions, but we may wonder where to use those true/false returning function in our daily programming life. The answer is we can use this in the following scenario: 1. when we have to evaluate the objects from the same class which will result in the true or false. 2. to filter the objects by using some of its variables etc. lets hack Predicate with some examples: A....