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"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical" > android:layout_height="fill_parent"
android:background="@color/background" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content" <ImageView
android:text="@string/hello" /> android:id="@+id/camera3"
android:layout_width="fill_parent"
</LinearLayout> android:layout_height="40dip"
\ No newline at end of file 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 @@ ...@@ -3,5 +3,6 @@
<string name="hello">Hello World, MobileEventGuide!</string> <string name="hello">Hello World, MobileEventGuide!</string>
<string name="app_name">MobileEventGuide</string> <string name="app_name">MobileEventGuide</string>
<color name="background">#ffffff</color>
</resources> </resources>
\ No newline at end of file
package mobile.event.org; package mobile.event.org;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle; 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. */ /** Called when the activity is first created. */
int CAMERA_PIC_REQUEST=3333;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.main); 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