What is the maximum amount of RAM an app can use?

I am quite curious about this question concerning the memory management of the Android operating system so I hope for a quite detailed answer on that topic. What I would like to know: What is the maximum amount of memory (in megabytes / as percentage of the total RAM) that an Android application (that is […]

Right Align button in horizontal LinearLayout

Just a quick stupid question. If you look at the attached image. I need my button to be right aligned but for some reason it’s not working with ‘gravity:right’… Here’s my code for that layout: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:orientation=”horizontal” android:layout_marginTop=”35dp”> <TextView android:id=”@+id/lblExpenseCancel” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”@string/cancel” android:textColor=”#404040″ android:layout_marginLeft=”10dp” android:textSize=”20sp” android:layout_marginTop=”9dp” /> <Button android:id=”@+id/btnAddExpense” android:layout_width=”wrap_content” android:layout_height=”45dp” […]

showDialog deprecated. What's the alternative?

Is there something else that should be called? showDialog(TIME_DIALOG_ID); It’s in this tutorial but says deprecated in Eclipse.

Refreshing OAuth token using Retrofit without modifying all calls

We are using Retrofit in our Android app, to communicate with an OAuth2 secured server. Everything works great, we use the RequestInterceptor to include the access token with each call. However there will be times, when the access token will expire, and the token needs to be refreshed. When the token expires, the next call […]

Animate visibility modes, GONE and VISIBLE

So im trying to animate when i set the visibility of a linearlayout with other widgets, from GONE to VISIBLE and the opposite.Im using togglebuttons to show and hide. Here’s an image to show what i want to do: I can show and hide, but im not following how can i animate the sliding correctly….:( […]

Multiline TextView in Android?

I did like below in xml <TableRow> <TextView android:id=”@+id/address1″ android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:gravity=”left” android:maxLines=”4″ android:singleLine=”false” android:text=”Johar Mor, Gulistan-e-Johar, Karachi” > </TextView> </TableRow> It is not working for multiline, and I am using TableLayout… so what is mistake I am doing here?

How to hide Soft Keyboard when activity starts

I have an Edittext with android:windowSoftInputMode=”stateVisible” in Manifest. Now the keyboard will be shown when I start the activity. How to hide it? I cannot use android:windowSoftInputMode=”stateHidden because when keyboard is visible then minimize the app and resume it the keyboard should be visible. I tried with InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); but […]

Android Studio Gradle: Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package

I am trying to upgrade my google play services dependencies to 8.4.0 by following the example Google gives here, but I am getting the following error (‘com.example.exampleapp’ is a replacement for my app package name): Error:Execution failed for task ‘:app:processDebugGoogleServices’. > No matching client found for package name ‘com.example.exampleapp’ Project build.gradle: buildscript { repositories { […]

Is a RelativeLayout more expensive than a LinearLayout?

I’ve always been using RelativeLayout everytime I needed a View container, because of it’s flexibility, even if I just wanted to display something really simple. Is it ok to do so, or should I try using a LinearLayout when I can, from a performance/good practices standpoint? Thanks!

Does BroadcastReceiver.onReceive always run in the UI thread?

in my App, I create a custom BroadcastReceiver and register it to my Context manually via Context.registerReceiver. I also have an AsyncTask that dispatches notifier-Intents via Context.sendBroadcast. The intents are sent from a non-UI worker thread, but it seems that BroadcastReceiver.onReceive (which receives said Intents) always runs in the UI thread (which is good for […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.