Referencing an XML string in an XML Array (Android)-ThrowExceptions

Exception or error: in arrays.xml <string-array name=”my_items”> <item>My item 1</item> <item>My item 2</item> <item>My item 3</item> </string-array> in strings.xml <resources> <string name=”item1″>My item 1</string> <string name=”item2″>My item 2</string> <string name=”item3″>My item 3</string> </resources> I would like to reference the string in the array “My item 1” from strings.xml. How do I do that? How to …

How rotate line in Android XML?-ThrowExceptions

Exception or error: I’m trying to draw a diagonal line in an Android app with the XML, but it is not working. It simply draws a horizontal line. main.xml: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:paddingBottom=”@dimen/activity_vertical_margin” android:paddingLeft=”@dimen/activity_horizontal_margin” android:paddingRight=”@dimen/activity_horizontal_margin” android:paddingTop=”@dimen/activity_vertical_margin” tools:context=”.TestActivity” > <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_alignParentLeft=”true” android:layout_alignParentTop=”true” style=”@style/diagonalStyle”> </RelativeLayout> </RelativeLayout> styles.xml: <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”diagonalStyle”> <item name=”android:background”>@drawable/background</item> …

xml – error: No resource identifier found for attribute 'textAlignment' in package 'android'-ThrowExceptions

Exception or error: This is my res/layout mobile.xml file. Where is my mistake? When I run textview has this error. <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:padding=”5dp” > <ImageView android:id=”@+id/grid_item_image” android:layout_width=”100dp” android:layout_height=”118dp” android:src=”@drawable/android_logo” > </ImageView> <TextView android:id=”@+id/grid_item_label” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_marginTop=”15dp” android:text=”@+id/label” android:textSize=”25dp” android:textAlignment=”center” > </TextView> </LinearLayout> How to solve: textAlignment was added in API …

xml – Android – Center Textview in LinearLayout-ThrowExceptions

Exception or error: I am trying to center a TextView in a LinearLayout and it is centering horizontaly but not vertically. below is my code <LinearLayout android:orientation=”vertical” android:layout_width=”320dp” android:layout_height=”50dp” android:background=”@drawable/rectblack” android:layout_marginTop=”10dp” android:layout_gravity=”center” android:minWidth=”25px” android:minHeight=”25px”> <TextView android:text=”Explode a Vin” android:gravity=”center” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:id=”@+id/tvExVin” /> </LinearLayout> In the end I would like it to be centered vertically …

"Press and hold" button on Android needs to change states (custom XML selector) using onTouchListener-ThrowExceptions

Exception or error: I’ve got a button graphic which needs to have “press and hold” functionality, so instead of using onClickListener, I’m using onTouchListener so that the app can react to MotionEvent.ACTION_DOWN, and MotionEvent.ACTION_UP Depending on how quickly those two events are triggered, I can run a “pressAndHoldHandler” in the time between the two. Anyway, …