Monday, July 15, 2013

Custom Android Dialog Without Title

I searched a lot for creating android custom dialog without title. At last i found the following. Create custom android dialog without title in the following way.

Step-1: Add a android style in style.xml file :
          <style name="TitleLessDialog" parent="android:style/Theme.Dialog">
    <item name="android:windowNoTitle">true</item>
 </style>

Step-2: While declaring the dialog in your activity file declare as following

.
import android.app.Dialog;

import android.content.Context;
.
.
Context context = this;
Dialog dialog = new Dialog(context,R.style.TitleLessDialog);
.
.
.


The rest of your code is as usual Dialog building code.

Thank you.
bodhisattwa

Creating Android Custom TextView Rounded Corner Programmatically

To create a rounded corner custom TextView in your android application, follow the below steps.


Step-1: Create a custom xml file named "custom_shape.xml" under /res/drawable folder.

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
 android:shape="rectangle"> 
 <gradient  
     android:angle="270"/>
<corners 
     android:bottomRightRadius="7dp" 
     android:bottomLeftRadius="7dp" 
     android:topLeftRadius="7dp" 
     android:topRightRadius="7dp"/> 
  <solid android:color="@android:color/transparent"/>  
  <stroke 
      android:color="@android:color/black"
      android:width="5sp"/> 
</shape> 

Step-2: Create a custom TextView class "TextViewOutLined.java"

public class TextViewOutLined extends TextView
{
public static int textSize = 30;  //The size of the text can be changed later
public TextViewOutLined(Context context) 
{  
super(context); 
init(); 
}
@Override   
 protected void onDraw(Canvas canvas) {  
super.onDraw(canvas);                 
this.setBackgroundResource(R.drawable.custom_shape);    
} 
private void init(){  
setTextSize(textSize);  
setPadding(5, 5, 5, 5);  //This will set the padding, and by increasing decreasing this 
// parameters the text padding can be changed 
}
}

Step-3: Use the class TextViewOutLined in your android program as:
private final TextViewOutLined tv = new TextViewOutLined(context);
tv.setText("www.appsoid.in");

Thank you.
bodhisattwa

Thursday, May 9, 2013

Android Market


Here is a list of all android market places:
  1. Amazon
  2. Google play
  3. GetJar
  4. SlideMe

Sunday, May 5, 2013

Android:Setting Color

Setting a custom color in your android application view is not very difficult one. There are two basic ways,
  • Either you can use user defined color , or
  • You can use custom defined color.

Android: Choosing User Defined Color

The steps to set a custom defined color is defined below:
  1. First open a Paint application in your windowsimage image
    Click on “Edit colors”
  2. Get the color code from Edit Colorsimage
  3. Or you can also choose the Hex-color code from the below table:HTMLColorCodes

Thursday, May 2, 2013

Android Architecture







Android is solely based on a open-source platform. Android is a Linux-based operating system. We all know how the basic functions such as making a call, sending a text message, changing the system settings, install or uninstall apps etc. Well! All Android users know these, but not enough for a developer. Then what else details are a developer required to know about Android, I’ll explain. To be a developer, you should know all the key concepts of Android. That is, you should know all the nuts and bolts of Android OS.

Linux Kernel

The basic layer of Android  is the Linux kernel. The whole Android OS is built on top of the Linux 2.6 Kernel with some further architectural changes made by Google.  It is this Linux that interacts with the hardware and contains all the essential hardware drivers. Drivers are programs that control and communicate with the hardware. For example, consider the Bluetooth function. All devices has a Bluetooth hardware in it. Therefore the kernel must include a Bluetooth driver to communicate with the Bluetooth hardware.  The Linux kernel also  acts as an abstraction layer between the hardware and other software layers. Android uses the Linux for all its core functionality such as Memory management, process management, networking, security settings etc. As the Android is built on a most popular and proven foundation, it made the porting of Android to variety of hardware, a relatively painless task.

Libraries

The next layer is the Android’s native libraries. It is this layer that enables the device to handle different types of data. These libraries are written in c or c++ language and are specific for a particular hardware.
Some of the important native libraries include the following:
Android Surface Manager: It is used for compositing window manager with off-screen buffering. Off-screen buffering means you cant directly draw into the screen, but your drawings go to the off-screen buffer. There it is combined with other drawings and form the final screen the user will see. This off screen buffer is the reason behind the transparency of windows.
Android Media framework: Media framework provides different media codecs allowing the recording and playback of different media formats
Android SQLite database: SQLite is the database engine used in android for data storage purposes
WebKit: It is the browser engine used to display HTML content
OpenGL: Used to render 2D or 3D graphics content to the screen. OpenGL for Embedded Systems (OpenGL ES) is a subset of the OpenGL 3D graphics application programming interface (API) designed for embedded systems such as mobile phones, PDAs, and video game consoles. There is no GLUT or GLU. OpenGL ES is managed by the not-for-profit technology consortium, the Khronos Group, Inc.

Wednesday, May 1, 2013

Android: Creating a new project


Preparing your machine for android application making
Dealing with making an android application means you should have following things installed in your PC.
Step-1: First of all you should have Java Development Kit (JDK) installed in your machine. You can get JDK from the following link: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Step-2: After installing the latest version of JDK, your job is to set the class path for the JDK. For this, you have to go to the installation folder of JDK in program files. Normally this is located to C:\Program Files\Java\jdk1.7.0_09\bin.  Now copy this whole path “C:\Program Files\Java\jdk1.7.0_09\bin”. Close the window. Right click on Computer.

Then go to Properties > Advanced system settings > Advanced > Environment variables  . If a variable name “Path” is already there , then click “Edit”  and append the previously copied variable value at the end of the string. Otherwise In System variable click on “New” and name the new variable “Path” and then append the previously copied variable value as the value of the string.

image