Download and install application

by Nando Android » Sun, 27 Jun 2010 04:48:13 GMT


Sponsored Links
 Hello all,

Is there any howto on donwloading via HTTP an application package and
installing it afterwards?

Thanks.

--



Download and install application

by Lance Nanek » Sun, 27 Jun 2010 06:10:36 GMT


 Do you mean doing it via code? Or do you mean how to explain to a user
how to do it manually?




--


Sponsored Links


Download and install application

by Nando Android » Sun, 27 Jun 2010 08:10:08 GMT


 I would like to do it via code. Do a HTTP request, get the package and then
install it. Is there any example out there for it?

Thanks.





>



Other Threads

1. Canvas Scaling issues

Hey folks,

A few weeks ago I posted a view I was working on and in that time I
have improved the view a lot, but I've been asked to add a new
features of zooming into the image.

The view is a custom image viewer that allows large images (such as
640x1000) to be loaded, and the user to scroll around using either the
touchscreen or trackball on the device.  The code below is reasonably
succesful in that it works at the default scale level of 1.

But with addign zooming, instead of zooming into the 'centre' of the
location the user is looking at, and allowing the user to move around
the whole of the image at this level it instead zooms into the top and
left of the location, and in doing so it starts to cut off the bottom
and right of the image whole, so while zoomed in you cannot go any
ruther right or down in the image, but you can go to the top and left
easily enough.

The best example of what I am trying to achive is the Image viewer in
the camera application.

So my two questions are:

1) Can anyone suggest how I can fix this in the canvas or
2) Is there a better way to do this with an existing feature in the
framework?

I'm probably thinking it's something to do with the modifierValue when
scrolling around that I somehow need to increase this, but trying this
causes my activity to crash.

Code:

public class ZN5ScrollView extends View {

        public ZN5ScrollView(Context context, AttributeSet attrs) {
                super(context, attrs);

                scrollX = 0;
                scrollY = 0;
                scale = 1.0f;
                modifierValue = 50;

                ViewPaint = new Paint();

                TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ZN5ScrollView);
                LoadedBitmap = 
BitmapFactory.decodeResource(context.getResources(),
a.getResourceId(R.styleable.ZN5ScrollView_src, R.drawable.icon));

                IMAGE_WIDTH = LoadedBitmap.getWidth();
                IMAGE_HEIGHT = LoadedBitmap.getHeight();

                ViewBitmap = Bitmap.createBitmap(LoadedBitmap);
        }

        protected void onSizeChanged  (int w, int h, int oldw, int oldh) {
                SCREEN_WIDTH = w;
                SCREEN_HEIGHT = h;

                if (IMAGE_WIDTH < SCREEN_WIDTH) {
                        IMAGE_WIDTH = SCREEN_WIDTH - scrollX;
                }
                if (IMAGE_HEIGHT < SCREEN_HEIGHT) {
                        IMAGE_HEIGHT = SCREEN_HEIGHT - scrollY;
                }

        }

        @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.scale(scale, scale);
        canvas.drawBitmap(ViewBitmap, 0f, 0f, ViewPaint);
    }

public void handleView(int zoomType) {
        switch (zoomType) {
        case ZOOM_IN:
                if (scale <= 1.5f) {
                        scale = scale + 0.1f;
                }
                break;
        case ZOOM_OUT:
                if (scale > 1.0f) {
                        scale = scale -0.1f;
                }
                break;
        }
        invalidate();
}


public void handleScroll(float distX, float distY) {
        /* X-Axis */
        if(distX > 6.0) {
                if(scrollX < IMAGE_WIDTH) {
                        scrollX = Math.min(IMAGE_WIDTH - SCREEN_WIDTH, scrollX +
modifierValue);
                }
        }
        else if(distX < -6.0) {
                if(scrollX >= 50) {
                        scrollX = Math.min(IMAGE_WIDTH + SCREEN_WIDTH, scrollX -
modifierValue);
                } else {
                        scrollX = 0;
                }
        }

        /* Y-Axis*/
        if(distY > 6.0) {
                if(scrollY < IMAGE_HEIGHT) {
                        scrollY = Math.min(IMAGE_HEIGHT - SCREEN_HEIGHT, 
scrollY +
modifierValue);
                }
        }
        else if(distY < -6.0) {
                if(scrollY >= 50) {
                        scrollY = Math.min(IMAGE_HEIGHT + SCREEN_HEIGHT, 
scrollY -
modifierValue);
                } else {
                        scrollY = 0;
                }
        }

        if((scrollX <= IMAGE_WIDTH) && (scrollY <= IMAGE_HEIGHT)) {
                ViewBitmap = Bitmap.createBitmap(LoadedBitmap, scrollX, scrollY,
SCREEN_WIDTH, SCREEN_HEIGHT);
                invalidate();
        }
}

private int modifierValue;

private float scale;
public final int ZOOM_IN = 1;
public final int ZOOM_OUT = 2;

private int SCREEN_WIDTH;
private int SCREEN_HEIGHT;

private int IMAGE_WIDTH;
private int IMAGE_HEIGHT;

private int scrollX;
private int scrollY;

private Bitmap LoadedBitmap;
private Bitmap ViewBitmap;
private Paint ViewPaint;
}


Regards,
Tane
--~--~---------~--~----~------------~-------~--~----~

2. SystemServer permissions ..

System server is starting up other services, however, towards the end,
if we were add any code to access any of the started services, it
throws out a error saying PERMISSION not defined.

E/SystemServer( 1861): java.lang.SecurityException: Requires
ACCESS_FINE_LOCATION permission

The general mode is to create an apk with the service and hence we
will have a way to describe the required permissions in the manifest.
However, if we want to do the same in the platform, how can one add
permissions ? and what sort of permissions does SystemServer have (eg.
ACCESS_FINE_LOCATION )?
--~--~---------~--~----~------------~-------~--~----~

3. Camera Captured Image not Saving

4. Android Market :: Free application gets to top of pile on new release, paid app doesn't?

5. Android build didn't create contents of /data directory

6. how should i buy apps

7. How to add Google Maps library, Maps to the Android 1.5 version device?