[Solved] Unable to show Toast

first of all add both items in list using following code: list.add(model(name, roomid)); Also create a model class for RoomModel like this: public class RoomModel { public String name, id, image, description; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } … Read more

[Solved] What are the differences between ArrayList and ArrayMap?

ArrayMap keeps its mappings in an array data structure — an integer array of hash codes for each item, and an Object array of the key -> value pairs. Where ArrayList is a List. Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. FYI ArrayMap is a … Read more

[Solved] Use one account in 1000 devices

From Google Play Terms of Service Limits on access on Devices. Google may from time to time place limits on the number of Devices and/or software applications you may use to access Content (for more information, please visit the Help link for the relevant Content within Google Play). Google may record and store the unique … Read more

[Solved] How to pass EditText value in SharedPreferences

You called these functions in onCreate function. You should put theme in a button’s listener button.setOnClickListener(new View.OnClickListener { @Override private void onClick(View view){ // get text from EditText // put text to SharedPreferences } }); When application started, there is nothing in your EditText. 0 solved How to pass EditText value in SharedPreferences

[Solved] How to call this function from other activities?

Create Kotlin file, e.g. named Utils; Move function to that file, and add Context parameter: fun checkConnectivity(ctx: Context): Boolean { val cm = ctx.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetwork =cm.activeNetworkInfo return activeNetwork != null && activeNetwork.isConnectedOrConnecting } If you intend to use it only in Activity you can create extension function without Context parameter: fun Activity.checkConnectivity(): … Read more

[Solved] how to get strings from a string array and show it one by one in a TexttView using Buttons (android)

The function for onClick attribute in XML has to be something like, public void yourFunction (View view) { //Your code } Since you didn’t add View as the argument of your function, your layout is never going to get to it, hence when you click on your button, the app crashes. You also need to … Read more

[Solved] Splitting a String which has longitude and latitude points

If we can guarantee that the String to parse is always defined in a canonical way, so that is defined as lat+long ALWAYS, then using regex will be the easiest way: Example: String latLong = “lat/lng: (55.94569390835889,-3.190410055779333)”; Pattern patte = Pattern.compile(“-?[0-9]+(?:.[0-9]+)?”); Matcher matcher = patte.matcher(latLong); while (matcher.find()) { System.out.println(Double.parseDouble(matcher.group())); } solved Splitting a String which … Read more

[Solved] Getting Name,Phone Number and Email Address From Phone Contacts [closed]

I do it this way for Android 2.2 Froyo release: basically use eclipse to create a class like: public class SomePickContactName extends Activity then insert this code. Remember to add the private class variables and CONSTANTS referenced in my version of the code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intentContact = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); … Read more