Tuesday, 22 January 2013

Flag Animation in android



Hi all,
Everyone wants  application to be beautiful and attractive for an eye of a user. I'm searching for different type of animations in android after I found small animation  look like a flag.
Now we’ll make it fade-in and fade-out. Create in appfolder /res folder new folder "anim" and add to it two Android XML files – appear.xml and disappear.xml. They will be alpha animations.

appear.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha
        android:interpolator="@android:anim/accelerate_interpolator"
        android:fromAlpha="0.0" android:toAlpha="1.0"
        android:duration="800"
    />
</set>

disappear.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha
        android:interpolator="@android:anim/decelerate_interpolator"
        android:fromAlpha="1.0" android:toAlpha="0.0"
        android:duration="800"
    />
</set>

Here is a set of frames and “oneshot” attribute says to loop them. To run animation. Create flag.xml in drawable folder.

flag.xml:
<?xml version="1.0" encoding="utf-8"?>
<animation-list     
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/flaganim"
    android:oneshot="false"
    >
    <item android:drawable="@drawable/f03" android:duration="100" />
    <item android:drawable="@drawable/f04" android:duration="100" />
    <item android:drawable="@drawable/f05" android:duration="100" />
    <item android:drawable="@drawable/f06" android:duration="100" />
    <item android:drawable="@drawable/f07" android:duration="100" />
    <item android:drawable="@drawable/f08" android:duration="100" />
    <item android:drawable="@drawable/f09" android:duration="100" />
    <item android:drawable="@drawable/f10" android:duration="100" />    
</animation-list> 

Here the java code....

  // Start animating the image
 final ImageView ImageView = (ImageView) findViewById    (R.id.ImageView);
ImageView.setBackgroundResource(R.drawable.flag);
final AnimationDrawable frameAnimation = (AnimationDrawable)ImageView.getBackground();
   ImageView.post(new Runnable(){
@Override
public void run() {
frameAnimation.start();
}    
   });

  Finally, 
         Image look like a flag:



Thursday, 10 January 2013

Voice Conversion ........

Hi Guys......
i am implementing an Application, it is similar to Talking Tom Application, in My application i have to Place a Character Like A Alien  Voice for this i have to convert the Human Voice to Alien Voice ....
for this voice modulation i did't get the any solution....!!!!!
  Suggest me if any one.......

Tuesday, 8 January 2013

Adding Bitmap Image into Canvas in Android


Hi,
                    I’m developing  a Maze Game in Android.    I  faced a problem with adding the image into Canvas. Actually I draw the circle by using canvas is working but I need to add the image from drawable.This is for Sample code for draw circle by using canvas….
Paint ball = new Paint();
ball.setTextSize(cellHeight*0.75f);
canvas.drawCircle((currentX * totalCellWidth)+(cellWidth/2),   //x of center
                  (currentY * totalCellHeight)+(cellWidth/2),  //y of center
                  (cellWidth*0.45f), ball);

                   Here  In this place I want add the image into canvas from drawable..
I use the below code for adding image into canvas.but it is not working touch Listener to drawable image.
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.green);
canvas.drawBitmap(bmp,current,currentY ,null);   
                          
            Finally   I got the solution to this touch event functionality for drawable image. Following code I used its working if any other way is their please let me know.

Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.green);
       Bitmap img = Bitmap.createScaledBitmap( bmp,25,25, true );
canvas.drawBitmap(img,(currentX * totalCellWidth)+(cellWidth/6) ,(currentY * totalCellHeight)+(cellWidth/6),null);

And In the onTouchEvent method. I use the below code:

public boolean onTouchEvent(MotionEvent event) {
float touchX = event.getX();
float touchY = event.getY();
int currentX = maze.getCurrentX();
int currentY = maze.getCurrentY();
switch (event.getAction() & MotionEvent.ACTION_MASK) {
   case MotionEvent.ACTION_DOWN:
                //touch gesture started
                if(Math.floor(touchX/totalCellWidth) == currentX &&
                Math.floor(touchY/totalCellHeight) == currentY) {
                //touch gesture in the cell where the ball is
                dragging = true;
                return true;
                }
                break;
   case MotionEvent.ACTION_UP:
                //touch gesture completed
                dragging = false;
                return true;
                case MotionEvent.ACTION_MOVE:
                if(dragging) {
                int cellX = (int)Math.floor(touchX/totalCellWidth);
                int cellY = (int)Math.floor(touchY/totalCellHeight);                                                          
                if((cellX != currentX && cellY == currentY) ||
                (cellY != currentY && cellX == currentX)) {
                //either X or Y changed
                boolean moved = false;
                //check horizontal ball movement
        switch(cellX-currentX) {
                case 1:
                moved = maze.move(Maze.RIGHT);
                break;
                case -1:
                moved = maze.move(Maze.LEFT);
                }
                //check vertical ball movement
                switch(cellY-currentY) {
                case 1:
                moved = maze.move(Maze.DOWN);
                break;
                case -1:
                moved = maze.move(Maze.UP);
                }
                if(moved) {
                //the ball was moved so we'll redraw the view
                invalidate();
                if(maze.isGameComplete()) {
                                //game is finished
                                showFinishDialog();
                }
                  }
                          }
                return true;
                      }
                           }
                 return false;
                }

Monday, 7 January 2013



MS Project software downloadable links

I am looking for MS project software download version. I came to know that the specifications for downloading the software are

X86 platforms

Windows 7
Windows Vista SP1
Windows XP SP3
Windows Server 2003 SP2

X64 platform

Windows 7
Windows Vista SP1
Windows Server 2008

After searching I found the download version of the software for Windows XP SP2
This is the link to download the MS Project version 2007 for Windows XP SP2

After downloading it will ask for the Product key. Sometimes product key that comes with software doesn’t work. So these are the updated product keys to enter

G2XT7-K47QK-BFVXC-83T9M-8Y63Q
Or
T7CBB-KW6DD-VTHB9-6V4D4-K3393

If anyone wants to work with MS Visio this is the link for downloading the latest version


For MAC

Go through this link for complete tutorial and latest download version of the software

Saturday, 5 January 2013

Creating Charts using Chart Control in Asp.net 4.0

Microsoft Visual Studio Introduced Chart control in framework 4.0 This control have different types charts like Pie,Gant,Spline,Bubble..etc.

Follow below steps create chart using chartcontrol.

 1. Create Asp.net c# web application in visual studio 2010 and add new web page chart.aspx.

2. Open toolbox list out the chart control in data category. Drag and drop the control in chart.aspx page.   When a chart control is added into the page, such a register info will be added to the same page.
   
           <%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="chrt" %>

3. Add series and chartType to chat control which equals to column and chartarea property with the value as chartarea1.

      <asp:Chart Id="chart1" runat="server" height="400px" width="500px">
          <Series>
                 <asp:Series Name="Series1" ChartType="Column" ChartArea="ChartArea1"></asp:Series>
                 <asp:Series Name="Series2" ChartType="Column" ChartArea="ChartArea2"></asp:Series>
          </Series>
         <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
          </ChartAreas>
    </asp:Chart>

4.Create data source for the chat control via datatable in the behind code . In this step please directly follow the metho createdatatale in chart.aspx.cs as this is not what we are talking about in this project.

5 Bind the datasource to the chart control.
           
                chart1.series[0].YValuemembers="Volume1";
                chart1.series[1].YValueMembers="Volume2";
                chart1. series[0].XValueMember="Date";

6. Build the solution and run.
 
Reference links are:
      http://msdn.microsoft.com/en-us/library/dd489231(VS.100).aspx
   http://www.asp.net/learn/aspnet-4-quick-hit-videos/video-8770.aspx


Parsing HTML in C#

 This is useful  for html parsing 

code

var web = new HtmlWeb(); 
var doc = web.Load("http://www.stack.com");
HtmlDocument document = new HtmlDocument(); 
string htmlString = doc.toString();
document.LoadHtml(htmlString);
HtmlNodeCollection collection = document.DocumentNode.SelectNodes("//a");
foreach (HtmlNode link in collection)
{
     string target = link.Attributes["href"].Value;
}
 

Android supporting all devices - categorize drawables and layouts


Hi friends
Design the android UI for multiple devices (Resolutions) create folders as follows.

For preparing layouts create as follows:

Read the document 

For portrait:

res/layout/main.xml            
res/layout-small/main.xml            
res/layout-large/main.xml            
res/layout-normal/main.xml            
res/layout-xlarge/main.xml            
For landscape:

res/layout-land/main.xml            

res/layout-small-land/main.xml            
res/layout-large-land/main.xml            
res/layout-normal-land/main.xml            
res/layout-xlarge-land/main.xml            

For Drawable create folders as follows:

For portrait:

drawable 

drawable-hdpi 

drawable-mdpi 

drawable-lpdi 

For landscape:

drawable-land 

drawable-land-hdpi 

drawable-land-mdpi 

drawable-land-lpdi