Tag: xml

Change the tint of drawable in xml selector

I have a button with the background defined in xml. I would like to tint the button based on the current state it is in – ie – pressed, focussed, normal. Here is my xml file below. Also, my colored_tint_dark, and colored_tint are both translucent colors that I am trying to draw over the drawable […]

How do I generate XML resources at runtime on Android?

I have different strings.xml files in my resources folders (values, values_fr, values_de…), and I would like to load additional translations during runtime. Is it possible to add the new strings to those files even if it has already been compiled? Or is there a workaround?

Android Databinding: “Method references using '.' is deprecated”

When using databinding in my app, I get the following warning when compiling: Warning:Method references using ‘.’ is deprecated. Instead of ‘handler.onItemClick’, use ‘handler::onItemClick’ Please see my XML below. <?xml version=”1.0″ encoding=”utf-8″?> <layout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools”> <data> <variable name=”handler” type=”ClickHandler”/> <variable name=”active” type=”boolean”/> </data> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:onClick=”@{!active ? handler.onItemClick : null}” android:background=”@color/backgroundWhite”/> </RelativeLayout> </layout> […]

How to set the max height of a Layout in android?

I have to implement layout like this; The layout should wrap the content if the content within it is less. If the content goes beyond some size, like 300dp, it should be set to max heght(300dp) and that be able to scroll. Is there any properties to do like this, if not any workaround?

How can I programatically decompile dex files within Android?

I know how to extract apk files to classes using a windows based system as below: Step 1:Renaming .apk file Rename the .apk file with the extension .zip (for example let the file be “demofile.apk” then after renaming it becomes “demofile.apk.zip”) Step 2:Getting java files from apk Now extract the renamed zip file in specific […]

Why I am getting different HttpResponse than browser in android?

I am trying to get simple HTTP response from this URL : http://realtorsipad.demowebsiteonline.net/eventsfeed.php But surprisingly it not returning expected XML response rather returning another HTML page! I am not being able understand what is issue. Here is sample activity : public class MainActivity1 extends Activity { String parsingWebURL = “http://realtorsipad.demowebsiteonline.net/eventsfeed.php”; String line = “”; Document […]

XML With SimpleXML Library – Performance on Android

I’m using the Simple XML library to process XML files in my Android application. These file can get quite big – around 1Mb, and can be nested pretty deeply, so they are fairly complex. When the app loads one of these files, via the Simple API, it can take up to 30sec to complete. Currently […]

Unity3D and Android Studio Integration

Anyone know integrate Android with Unity Studio? (i will explain) I created a simple scene in Unity (4.3.x on OSX Maverics) for testing. Has a 3D object and nothing else. I do this in XCode using the Stackoverflow explanations here and i post my complete code here ( Touch a UIButton and show Unity on […]

Java Not Recognizing ID of Android XML Elements

Hello fellow programmers! I am doing a tutorial but have ran into a snag that I cannot solve. When I set up the link of XML elements to Java like this: Image1 = (ImageView) findViewById(R.id.ivImage1); It does not recognize the id even though it is the exact one in the XML. ivImage1 ivImage2, and ivImage3 […]

Android: How can I make text views float to the left?

I want to make textviews float to the left (like css floats). The reason I have so many textviews is I want every word in my app to be clickable. So I want this result: Currently, I have the following xml codes: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”horizontal” android:baselineAligned=”false”> <TextView android:text=”@string/nicholasStr” android:layout_width=”wrap_content” android:textSize=”18sp” […]

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