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