Thursday, February 16, 2012

Sunday, January 22, 2012

Flex Adobe Air SQLite search query syntax

Adobe AIR does not support SQLite FTS.

To search for particular rows using WHERE & LIKE

SELECT * FROM tablename WHERE columnname LIKE :columnname"

:columnname holds the value "%somevalue%

Below are the few syntax for SQLite & Adobe AIR

Table Creation

CREATE TABLE IF NOT EXISTS tablename (id INTEGER PRIMARY KEY AUTOINCREMENT, column1 TEXT NOT NULL, column2 TEXT, column3 TEXT, columndate DATE)

Selecting rows using WHERE

SELECT * FROM tablename WHERE columnname = "somevalue" 

SQLite Date Comparison

SELECT * FROM tablename WHERE date(columndate) = date("somevalue") 

SQLite Multiple WHERE conditions

SELECT * FROM tablename WHERE columnname = "somevalue" AND columnname2 = "somevalue" 

SQLite INSERTing rows

INSERT INTO tablename (column1, column2, column3, column4) VALUES ( "somevalue", "somevalue", "somevalue", "somevalue" ) 

SQLite INSERTing multiple rows at once

INSERT INTO tablename (column1, column2, column3, column4) SELECT 'somevalue', 'somevalue', 'somevalue', 'somevalue' UNION SELECT 'somevalue', 'somevalue', 'somevalue', 'somevalue'

Tuesday, January 3, 2012

Android form layout components example/sample

Android components in form layout example sample code shown below.

The output looks like in the below image.

Andriod form layout

main.xml has the following code to show the components in vertical layout. It should look like a form. <?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="vertical
    android:layout_margin="50sp"> 
    <TextView 
        android:layout_width="fill_parent
        android:layout_height="wrap_content
        android:gravity="center_horizontal
        android:text="@string/hello
        android:textSize="32sp" /> 

    <!-- Name -->

    <LinearLayout 
        android:layout_width="fill_parent
        android:layout_height="wrap_content
        android:paddingTop="50sp
        android:orientation="horizontal" > 
        <TextView 
            android:layout_width="200sp
            android:gravity="right
            android:layout_height="wrap_content
            android:text="@string/pname
            android:textSize="32sp" /> 
        <EditText 
            android:id="@+id/nameID
            android:layout_width="fill_parent
            android:layout_height="wrap_content
            android:layout_marginLeft="20sp
            android:inputType="text" > 
        </EditText> 
    </LinearLayout>

    <!-- Age --> 
    
    <LinearLayout android:layout_marginTop="50sp
        android:layout_width="fill_parent
        android:layout_height="wrap_content
        android:orientation="horizontal" > 
        <TextView 
            android:layout_height="wrap_content
            android:layout_width="200sp
            android:gravity="right
            android:text="@string/page
            android:textSize="32sp" /> 
        <EditText 
            android:id="@+id/ageID
            android:layout_width="fill_parent
            android:layout_height="wrap_content
            android:layout_marginLeft="20sp
            android:inputType="text" /> 
    </LinearLayout> 
    
    <!-- Sex --> 
    
    <LinearLayout android:layout_marginTop="50sp" android:layout_gravity="center_vertical"
        android:layout_width="fill_parent
        android:layout_height="wrap_content
        android:orientation="horizontal" > 
        <TextView 
            android:layout_height="wrap_content
            android:layout_width="200sp
            android:gravity="right
            android:text="@string/psex
            android:textSize="32sp" /> 
        <RadioGroup android:orientation="horizontal
            android:layout_marginLeft="20sp
            android:layout_width="fill_parent
            android:layout_height="wrap_content"> 
            <RadioButton 
                android:textSize="24sp
                android:text="@string/pmale"/> 
             <RadioButton android:layout_marginLeft="20sp
                 android:textSize="24sp
                android:text="@string/pfmale"/> 
        </RadioGroup> 
    </LinearLayout>
</LinearLayout>

Android Failed to allocate memory: 8 error

When you try to run your app on android emulator, you might get the following error.

Failed to allocate memory: 8 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

The emulator does not start. This is due to the RAM issue.

If you set the RAM to 1024, somehow it does not work. It should be less than that.

You could try by setting it to 512MB. I have tried with the following values & works well. 648, 756, 820MB.

Related Posts Plugin for WordPress, Blogger...