Tag: xml

Using a non-android namespace prefix in child elements in a layout

I am trying to use custom attributes in some Android layouts, but I am getting an error (from Eclipse) when I try to use a namespace prefix other than android: in a child element. Note that it works ok when I use the custom: namespace prefix in the root/parent element in the file, just not […]

android.os.TransactionTooLargeException retrieving installed applications

I’m recovering all the applications installed on the device and I stumbled upon this error. java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:811) Caused by: java.lang.RuntimeException: Package manager has died at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:499) at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:485) at com.name.package.MyClass$RetrieveApps.doInBackground(MyClass.java:363) at com.name.package.MyClass$RetrieveApps.doInBackground(MyClass.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:288) […]

android – xml – include same layout multiple times does not work

I’m trying to include the following layout twice: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” > <com.viewpagerindicator.TabPageIndicator android:id=”@+id/indicator” android:layout_width=”match_parent” android:layout_height=”wrap_content” /> <android.support.v4.view.ViewPager android:id=”@+id/pager” android:layout_width=”match_parent” android:layout_height=”wrap_content” /> like the following <include android:id=”@+id/include1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” layout=”@layout/view_pager” /> <include android:id=”@+id/include2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” layout=”@layout/view_pager” /> Actually, the second view pager does not work if I do it […]

android.view.InflateException: Binary XML file line #33: Error inflating class

I am using custom Adapter class to work with RecyclerView, here is my code: public class CardAdapter extends RecyclerView.Adapter<CardAdapter.ViewHolder> { List<NatureItem> mItems; public CardAdapter() { super(); mItems = new ArrayList<NatureItem>(); NatureItem nature = new NatureItem(); nature.setName(“The Great Barrier Reef”); nature.setThumbnail(R.drawable.great_barrier_reef); mItems.add(nature); nature = new NatureItem(); nature.setName(“Grand Canyon”); nature.setThumbnail(R.drawable.grand_canyon); mItems.add(nature); } @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, […]

Error parsing XML: no element found

First off forgive me if I posted this question wrong. I’ve used stackoverflow for many problems but this is the first time I couldnt already find an answer to my problem. So, if I’m doing something wrong please let me know and I’ll repost / edit the question. Now unto business. I’ve just recently started […]

XML Spinner attributes textAlignment = “right” API 16

I’m trying to set attributes to a spinner on my android app and one of the attributes in textAlignment = “right” (the problem being I’ve a spinner that layout_width=”match_parent” so there’s a lot a space and I’d like to have it to the right) but this is only supported in API 17 and up whereas […]

How is AndroidManifest.xml validated in android studio?

How does android studio validate AndroidManifest.xml and any activity xml? I have read this post and this and know that there isn’t an actual schema for android manifest. But how does android studio or any tool that validates AndroidManifest.xml knows, what tags and elements are legal?

Why Android xml layout file doesn't recognize content assist by ctrl+space?

I am facing problem with eclipse that is when I am using the Android xml layout file to design a screen, I try to add attribute to an element that I have already created. I used to type two letters of the attribute then tap ctrl+space so it will show list of all available attribute […]

Why SwitchPreference is not showing animation when switching from on to off & vice versa?

I’ve made a SwitchPreference for my app’s preferences. The problem is that the SwitchPreference is not showing animation when I’m switching between on & off, rather, it is switching with a sudden jerk. Here’s preferences.xml file’s code: <?xml version=”1.0″ encoding=”utf-8″?> <PreferenceScreen xmlns:android=”http://schemas.android.com/apk/res/android”> <SwitchPreference android:id=”@+id/notification” android:key=”notification” android:title=”@string/notification” android:defaultValue=”true”/> </PreferenceScreen> I’m a beginner, so please cooperate & […]

How to Make Activity Which Appear on Half Screen?

i want to make an activity which appears on half screen (JUST LIKE DIALOG BOX BUT NOT DIALOG BOX) i want to add some text,switch buttons and labels on it ? i tried Dialog Boxes but it does not satisfy me so now i want to resize activity. HELP Thanks in advance

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