Hi micheal, Here i attache the code for accessing for inbuilt camer and gallery.
Take a look ..
package com.cool.coolapp;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
public class CoolApp extends Activity{
private static final int SELECT_PICTURE = 0;
private Bitmap bitmap;
private File file;
Bitmap thumbnail;
private Intent i;
private FileOutputStream fOut;
final static int TAKE_PICTURE = 1;
private Bitmap croppedImage;
Bitmap resizedBitmap;
private ImageView capturedimage;
private Button selectframe;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cool);
capturedimage = (ImageView)findViewById(R.id.captureimage);
ImageButton camera = (ImageButton)findViewById(R.id.imageButton1);
camera.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// Intent nextactivity = new
Intent(getApplicationContext(),Frame_ItActivity.class);
// startActivity(nextactivity);
// overridePendingTransition(R.anim.anim_in,R.anim.anim_out);
// overridePendingTransition(R.anim.anim_out, R.anim.rotate_out);
i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, TAKE_PICTURE);
overridePendingTransition(R.anim.incoming, R.anim.zoom_exit);
}
});
ImageButton gallery = (ImageButton)findViewById(R.id.imageButton3);
gallery.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent gallery = new Intent();
gallery.setType("image/*");
gallery.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(gallery,"Select
Picture"), SELECT_PICTURE);
overridePendingTransition(R.anim.fadein, R.anim.slide_down);
}
});
ImageButton about = (ImageButton)findViewById(R.id.about);
about.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Dialog dialog = new Dialog(CoolApp.this);
dialog.setContentView(R.layout.about);
dialog.setTitle("About Cool Frame");
dialog.show();
}
});
selectframe = (Button)findViewById(R.id.selectframe);
selectframe.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intd = new Intent(CoolApp.this,AndroidGridLayoutActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable("BITMAP_A", thumbnail);
intd.putExtras(bundle);
startActivity(intd);
//overridePendingTransition(R.anim.anim_in, R.anim.anim_out);
//overridePendingTransition(R.anim.outgoing, R.anim.incoming);
overridePendingTransition(R.anim.incoming, R.anim.outgoing);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
// TODO Auto-generated method stub
switch (requestCode) {
case TAKE_PICTURE:
if (resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
thumbnail = (Bitmap) extras.get("data");
capturedimage.setImageBitmap(thumbnail);
selectframe.setVisibility(View.VISIBLE);
}
break;
case SELECT_PICTURE:
if (resultCode == RESULT_OK) {
Uri selectedImageUri = data.getData();
// selectedImagePath = getPath(selectedImageUri);
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(selectedImageUri, projection, null, null,
null);
int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String tmppath = cursor.getString(column_index);
croppedImage = BitmapFactory.decodeFile(tmppath);
int width = croppedImage.getWidth();
int height = croppedImage.getHeight();
int newWidth = 200;
int newHeight = 200;
// calculate the scale - in this case = 0.4f
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// createa matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// rotate the Bitmap
//matrix.postRotate(45);
// recreate the new Bitmap
resizedBitmap = Bitmap.createBitmap(croppedImage, 0, 0,
width, height, matrix, true);
// make a Drawable from Bitmap to allow to set the BitMap
// to the ImageView, ImageButton or what ever
//BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);
Intent nextactivity = new
Intent(CoolApp.this,AndroidGridLayoutActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable("photo", resizedBitmap);
nextactivity.putExtras(bundle);
startActivity(nextactivity);
}
break;
}
}
}
enjoy [?]
with regards,
Mani..
On Wed, Jun 6, 2012 at 11:14 AM, Kristopher Micinski <[email protected]
> wrote:
> Of potential interest along this same line is Stowaway,
>
> http://android-permissions.org/
>
> It's analysis, while necessarily static, seems to work quite well, for
> the perhaps uninteresting cases..
>
> And of course, as Chris points out, you can imagine situations where
> the user constructs intents using strings input by the user, but in
> practice, you're almost never going to see a string for an intent
> object that can't be reconstructed by using some global constant
> propagation. The exception to this case is when you have some strange
> RPC sharing pattern, but I've never seen that. In these cases any
> analysis will simply fail, and usually error on the side of caution,
> telling you you do in fact need the permission..
>
> kris
>
> On Wed, Jun 6, 2012 at 1:40 AM, Kristopher Micinski
> <[email protected]> wrote:
> > On Wed, Jun 6, 2012 at 1:17 AM, Chris Stratton <[email protected]>
> wrote:
> >> On Jun 5, 7:29 pm, Kristopher Micinski <[email protected]> wrote:
> >>> >> Is there any way to retrieve the Intents used by intalled apps on
> the
> >>> >> phone? For example, how do I know that one app could send an Intent
> to
> >>> >> invoke Camera app or Email app or Text Message app?
> >>
> >>> But you could track this in the system, of course, which is what I
> >>> assume the OP wanted to do..
> >>
> >> Well, you can't really detect the potential (how do I know that one
> >> app "could") due to the potential crossovers between inputs, data, and
> >> code represented by things like intent objects and reflection.
> >>
> >
> > I spend a fair amount of time in research on static analysis of
> > permissions in Android apps doing exactly this, ;-)...
> >
> > A number of other systems try to do the same..
> > http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.2511
> >
> >> You can however detect the actual attempt as it occurs, to a degree by
> >> watching the logs, and more substantially by modifying the platform to
> >> in effect breakpoint Intent sending.
> >>
> >
> > Right, I think that's what I said, isn't it? I don't think I
> > mentioned potential, just dynamically, which is, as I said, what I
> > interpreted the OP to mean...
> >
> > kris
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en<<326.png>>

