Saturday, 17 March 2012

permission denied in Linux

If u get permission denied prob try with this comman in linux

 This command is for single file.

chmod 777 ./configure  .... ./configure is executable command in my case.

chmod 777 means giving permission to root,user and third person to read,write and execute.

chmod -R 777 folder name.

This is for the full folder.

android_log in txt format

This is to get the log in txt format

Goto androidsdk-platform tools in ur terminal and give this command.

 ./adb logcat >>/home/user/log.txt

download 9 patch images




android compassview

This class gives the compas view inandroid.Ihave give only the compassview .. this not the full project.

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class CompassView extends View {

    private static final Float RADIUS = 0.9F;
    private static final Float PI = 3.14F;
    private static final int ARC = 15;
    public static Float mAzimutAngle;
    private String mDirection;
    private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private boolean isDrawn;
   

    public CompassView(Context context) {
        super(context);
        init();
    }

    public CompassView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CompassView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    private void init() {
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(3);
        mPaint.setColor(Color.WHITE);
        mPaint.setTextSize(30);
        isDrawn = true;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),
                MeasureSpec.getSize(heightMeasureSpec));
    }

    @Override
    protected void onDraw(Canvas canvas) {

        int cx = getMeasuredWidth() / 2;
        int cy = getMeasuredHeight() / 2;
        float radiusCompass;
        if (cx > cy) {
            radiusCompass = (float) (cy * RADIUS);
        } else
            radiusCompass = (float) (cx * RADIUS);
        canvas.drawCircle(cx, cy, radiusCompass, mPaint);

        if (mAzimutAngle != null)
            canvas.rotate(mAzimutAngle, cx, cy);

        mPaint.setColor(0xff0000ff);

        if (!isDrawn) {
            canvas.drawLine(cx,    cy,
                    (float) (cx + radiusCompass
                            * Math.sin((double) (-ARC) * PI / 180)),
                    (float) (cy - radiusCompass
                            * Math.cos((double) (-ARC) * PI / 180)), mPaint);

            canvas.drawLine(cx,    cy,
                    (float) (cx + radiusCompass
                            * Math.sin((double) (ARC) * PI / 180)),
                    (float) (cy - radiusCompass
                            * Math.cos((double) (ARC) * PI / 180)), mPaint);
        }
        canvas.drawText(String.valueOf(mDirection), cx, cy, mPaint);
    }

    public void updateDirection(String direction) {
        isDrawn = false;
        mDirection = direction;

    }

}

android google maps

THis helps u to open the inbuilts maps in android.

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class MapActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
                Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
                startActivity(intent);

        setContentView(R.layout.main);
       
    }
}

/working-with-sd-cards-in-the-android-emulator

Follow this link

BUILD the android google code procedure

Follow this link

Android camera

 To open a camera with out any error in surface view.


package com.camera.preview.
import java.io.IOException;
import java.util.Vector;

import android.content.Context;
import android.hardware.Camera;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class CameraPreview extends SurfaceView implements
        SurfaceHolder.Callback {

    public static final String TAG = "CameraPreview";

    private SurfaceHolder mHolder;
    private Camera mCamera;
    boolean previewing = false;
    private boolean isPreviewRunning = false;

    Vector<NearByLocation> flag = new Vector<NearByLocation>();

    CameraPreview(Context context) {
        super(context);
        mHolder = getHolder();
        mHolder.addCallback(this);
        mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        setFocusable(true);
        setWillNotDraw(false);
    }

    public void surfaceCreated(SurfaceHolder holder) {
        try {
            System.out.println("surfaceCreated");
            if((!isPreviewRunning) && mCamera == null )
            mCamera = Camera.open();
            mCamera.setPreviewDisplay(holder);
            isPreviewRunning=true;
        } catch (IOException e) {
            System.out.println(e);
            mCamera.release();
            isPreviewRunning=false;
            mCamera = null;
            e.printStackTrace();
        }
    }

    public void surfaceDestroyed(SurfaceHolder holder) {

        if (isPreviewRunning && mCamera != null) {
            if (mCamera != null) {
                mCamera.stopPreview();
                mCamera.release();
                mCamera = null;
            }
            isPreviewRunning = false;
        }
    }

    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {

        if (isPreviewRunning) {
            mCamera.stopPreview();
        }
        try {
            mCamera.startPreview();
        } catch (Exception e) {
            Log.e(TAG, e.getMessage());
        }
        isPreviewRunning = true;
        mCamera.startPreview();
    }

}


Android -device debugging procedure in linux.

Below is the procedure to be followed for on device debugging in android.

Open terminal and traverse to  platform-tools in android SDK where you will find adb

Give $ ./adb devices then you will find

 List of devices attached
???????????? no permissions

So we need to give USB permission in order to do on device debugging

Step 1.

      Create/edit a file in /etc/udev/rules.d called 99-android.rules:

      $ sudo gedit /etc/udev/rules.d/99-android.rules

      Add the following line to it and save it:

      SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1, SYMLINK+=”android_adb”, MODE=”0666

Step 2. Restart udev:

        $ sudo restart udev


Step 3.

       $ ./adb kill-server
       $ ./adb start-server
       $ ./adb devices


Note: Sometimes  device require to disconnect the usb cable at this point and then reconnect it.

Lean Body mass

Lean Body mass-- Even i was hoping for this ,,,And frm my experiecne ill share u wat i did to gain mass in my lean body..
1) Initial thing u have to do is. do push ups as many as possible and raise ur hand power.
2)I have herad and experienced taht the body ll start to grow only after continous   three months workouts.Be reguler to get the lean mass.
3)I did gym for more then three months and raised my power.So, I could lift 20 kg dumble for chest, shoulders and n all. Soon after this ull see the change in ur body.

Ill share the videos as soons as possoble.

Android-ffmpeg

If anybody wanted to integrate the FFmpeg with ICS google,,i.e.. Wen u compile ur ICS ,FFmpeg should also be compiled,,Here are the steps for u to build the FFmpeg along with ur ICS,

1)Download the ffmpeg-ffmpeg-android usig this or if u have downloaded the ffmpeg android it also well and good.
2)Next, go to this path in ur ICS code -->src/frameworks/base/media/libstagefright.
3)Extract the ffmpeg. So, you ll find a folder as ffmpe-ffmpeg-android.Inside that ull find android.mk file and some folders named as libavcodec, libavutils,,.. so on.
4) In ffmpeg's android.mk file,give as call all sudirctives or the the folder which u want. THis is my android.mk in ffmpeg
  LOCAL_PATH := $(call my-dir)

FFMPEG_TOP := $(LOCAL_PATH)

include $(CLEAR_VARS)

include $(FFMPEG_TOP)/libavutil/Android.mk
include $(FFMPEG_TOP)/libavcodec/Android.mk
or
include $(call all-makefiles-under,$(LOCAL_PATH))

-->after giving ur path in ffmpeg android.mk. this ll call all ur sub folders android.mk inside ffmpeg.So, u can use all those inside the ffmpeg.

5) Next ,you have to  check the module names in those folder's android.mk file.here (libavutil,libavcodec).
            It ll be like LOCAL_MODULE := libavutil
6) So, now u have to open the libstagefright android.mk in thatunde local static libraries copy thos modules name.
I gave example ly for two folder.. if u want acces all the folders of ffmpeg, u must follow as i suggest and use those inside this folder.

LOCAL_STATIC_LIBRARIES := \
        libstagefright_color_conversion \
        libstagefright_aacenc \
        libstagefright_amrnbenc \
        libstagefright_amrwbenc \
        libstagefright_avcenc \
        libstagefright_m4vh263enc \
        libstagefright_matroska \
        libstagefright_timedtext \
        libvpx \
        libstagefright_mpeg2ts \
        libstagefright_httplive \
        libstagefright_rtsp \
        libstagefright_id3 \
        libFLAC \
        libavutil    \
        libavcodec    \


   7)Once done just foll0w the steps for compile the ICS code and move on.after compilation .under this directory
 out/target/product/generic/obj/Static_libraries
 You ll find libavutils and libavcodec intermediates
Nothing but the statice libs are built and u can use it.