Commit b30cacb0 authored by george dagkakis's avatar george dagkakis Committed by Georgios Dagkakis

bin ignored

parent 62106fcb
[user]
name = george dagkakis
email = gdagkakis@yahoo.com
/MobileEventGuide
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
\ No newline at end of file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background" >
<ImageView
android:id="@+id/camera3"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:clickable="true"
android:gravity="center"
android:src="@drawable/camera3"/>
<ImageView
android:id="@+id/pictureholder"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:layout_below="@+id/camera3"
android:src="@drawable/ic_launcher"/>
</RelativeLayout >
\ No newline at end of file
......@@ -3,5 +3,6 @@
<string name="hello">Hello World, MobileEventGuide!</string>
<string name="app_name">MobileEventGuide</string>
<color name="background">#ffffff</color>
</resources>
\ No newline at end of file
package mobile.event.org;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class MobileEventGuide extends Activity {
public class MobileEventGuide extends Activity implements OnClickListener{
/** Called when the activity is first created. */
int CAMERA_PIC_REQUEST=3333;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView CameraButton= (ImageView) findViewById(R.id.camera3);
CameraButton.setOnClickListener(this);
}
public void Camera(){
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_PIC_REQUEST) //
if (resultCode == Activity.RESULT_OK) {
// Display image received on the view
Bundle b = data.getExtras(); // Kept as a Bundle to check for other things in my actual code
Bitmap pic = (Bitmap) b.get("data");
if (pic != null) {
//Display your image in an ImageView in your layout (if you want to test it)
ImageView pictureHolder = (ImageView) this.findViewById(R.id.pictureholder);
pictureHolder.setImageBitmap(pic);
pictureHolder.invalidate();
}
}
else if (resultCode == Activity.RESULT_CANCELED) {}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.camera3:
Camera();
break;
}
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment