Wednesday 23 July 2014

Android: Create Round Buttons

To make a button round we can first make a shape.xml in our drawable folder

shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <stroke
        android:width="6dp"
        android:color="#FFFFFF" />

    <solid android:color="#FF66B2" />


    <corners
        android:bottomLeftRadius="45dp"
        android:bottomRightRadius="45dp"
        android:topLeftRadius="45dp"
        android:topRightRadius="45dp" />

</shape>

This shape can be used as a background of the button:

           <Button
                android:id="@+id/round1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/round_button"
                android:gravity="center" />

Tuesday 22 July 2014

Androlid: SQLite database plugin for Eclipse

Follow following steps to download and use SQLite database viewer in Eclipse:

Download .jar  file from the following -> link


  1. Place the plugin .jar file in your Eclipse plugins folder (e.g. eclipse/plugins)
  2. Close and Restart Eclipse
  3. Start the emulator in Eclipse
  4. Switch to the DDMS Perspective in Eclipse
  5. Go to the 'File Explorer' tab to locate your device's database file
  6. Navigate  'data -> data -> com.yourproject -> databases -> yourDB
  7. Open the database file in Questoid (click on the icon shown in the figure)
  8. Switch to the 'Questoid SQLite Browser' tab that appears in the bottom
  9. Switch to the 'Browse Data' sub tab 
  10. Select your table from the drop down menu and browse the table data

ADB server didn’t ACK, Failed to start Daemon

Follow the steps to get rid of this problem:

Step 1: Open the task manager, which has adb.exe process and end (kill) that process

Step 2: Now, close the eclipse, which is currently running on my computer.

Step 3: Again, restart eclipse then solved that problem.

Android: Start or Stop adb server from Command line

Open the cmd from Start ⇒ run ⇒ cmd


Command to kill ADB server
adb kill-server

Command to start ADB server
adb start-server

Tuesday 8 July 2014

HOW DO I CHANGE THE DATA TYPE FOR COLUNM IN MySQL

Query to change data type in MySQL table:

ALTER TABLE TABLENAME MODIFY COLUMNNAME double;

Example using this query:

ALTER TABLE transaction MODIFY receivedamount double;

Here:

TABLENAME = TRANSACTION
COLUMNNAME = RECEIVEDAMOUNT
DATATYPE = DOUBLE

MySQL change column name query

Here is a generic form of the query to change a column name in MySQL table:

alter table TABLENAME change OLDCOLUMNNAME NEWCOLUMNNAME varchar (10) ;

Example using this query:

Alter table transaction change amount receivedamount varchar(10);

Here:

TABLENAME = TRANSACTION
OLDCOLUMNNAME = AMOUNT
NEWCOLUMNNAME = RECEIVEDAMOUNT