Hey there so I want to create a App in android which have a overlayed Button and take a screenshot (if overlay Button is clicked) of every app on the phone (anything except these with FLAG_SECURE). I know that it's possible because this app actually do it: https://play.google.com/store/apps/details?id=com.tools.screenshot
So does anyone knows a code example which allows me to do this screenshot?
I already got the overlay Button so only need the screenshot code. Thanks
Too broad as answer, but had this from old blog:
taking_screenshot_in_android.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="16dp"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="#+id/capture_screen_shot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="screenShot"
android:text="Take ScreenShot" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="" />
<ImageView
android:id="#+id/imageView"
android:layout_width="200dp"
android:layout_height="250dp"
android:background="#ccc"
android:padding="5dp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:autoLink="web"
android:gravity="center|bottom"
android:text="ViralAndroid.com"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
TakingScreenShotAndroid.java
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
public class TakingScreenShotAndroid extends AppCompatActivity {
TextView textView;
ImageView imageView;
Bitmap mbitmap;
Button captureScreenShot;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.taking_screenshot_in_android);
textView = (TextView) findViewById(R.id.textView);
textView.setText("Your ScreenShot Image:");
captureScreenShot = (Button) findViewById(R.id.capture_screen_shot);
imageView = (ImageView) findViewById(R.id.imageView);
}
public void screenShot(View view) {
mbitmap = getBitmapOFRootView(captureScreenShot);
imageView.setImageBitmap(mbitmap);
createImage(mbitmap);
}
public Bitmap getBitmapOFRootView(View v) {
View rootview = v.getRootView();
rootview.setDrawingCacheEnabled(true);
Bitmap bitmap1 = rootview.getDrawingCache();
return bitmap1;
}
public void createImage(Bitmap bmp) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
File file = new File(Environment.getExternalStorageDirectory() +
"/capturedscreenandroid.jpg");
try {
file.createNewFile();
FileOutputStream outputStream = new FileOutputStream(file);
outputStream.write(bytes.toByteArray());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
strings.xml
<string name="app_name">Taking Screenshot in Android Programmatically</string>
Output:
Related
I have recently made an App which has a basic Intent which opens the default camera app on device.
But I want to expand it's functionality which will enable it to store the captured image from camera to the SQLite Database. Along with displaying the images already stored in the database. Also I want to display the Date & Time of the image which is captured below the image, as well as Add a Comment box below the date/time of the image.
The code for the MainActivity is as follows:
import android.content.Intent;
import android.graphics.Bitmap;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
ImageView imageView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnCamera = (Button) findViewById(R.id.btnCamera);
imageView = (ImageView) findViewById(R.id.imageView);
btnCamera.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
}
});
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap bitmap = (Bitmap)data.getExtras().get("data");
imageView.setImageBitmap(bitmap);
}
}
Code for the Activity's Layout XML is as follows:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:orientation="vertical"
android:weightSum="10"
tools:context=".MainActivity">
<ImageView
android:id="#+id/imageView"
android:layout_weight="9"
android:layout_width="match_parent"
android:layout_height="fill_parent"
/>
<Button
android:id="#+id/btnCamera"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/holo_red_dark"
android:textColor="#android:color/white"
android:text="Open Camera"
/>
</LinearLayout>
I want to pass images from one activity to another when button clicked. I have one button "Show Image" in first activity. When I click on it, it should pass two images from my mipmap folder of my project and go to second activity and show one of the passed image on the ImageView of that activity. On second activity, I have two buttons which are supposed to receive images and show those images when clicked on each button. I tried using intent to pass the image, however, it didn't work. Is there other way to send images from mipmap folder from one activity to another?
Here is my code:
MainActivity.java
package com.example.abina.myapplication;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import java.io.ByteArrayOutputStream;
public class MainActivity extends AppCompatActivity {
Button button;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
showmyImage();
}
});
}
public void showmyImage(){
Intent intent = new Intent(this, Main2Activity.class);
Bitmap bitmap; // your bitmap
bitmap = null;
ByteArrayOutputStream _bs = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 50, _bs);
intent.putExtra("byteArray", _bs.toByteArray());
startActivity(intent);
}
}
activity_main.xml
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="137dp"
android:text="Show Image" />
</RelativeLayout>
Main2Activity.java
package com.example.abina.myapplication;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;
public class Main2Activity extends AppCompatActivity {
Button image1;
Button image2;
ImageView imageView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
image1 =(Button) findViewById(R.id.image1);
image2 = (Button) findViewById(R.id.image2);
imageView =(ImageView) findViewById(R.id.imageView);
if(getIntent().hasExtra("byteArray")) {
Bitmap _bitmap = BitmapFactory.decodeByteArray(
getIntent().getByteArrayExtra("byteArray"),0,getIntent().getByteArrayExtra("byteArray").length);
imageView.setImageBitmap(_bitmap);
}
}
}
activity_main2.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Main2Activity">
<Button
android:id="#+id/image1"
android:layout_width="199dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="Image1" />
<Button
android:id="#+id/image2"
android:layout_width="183dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="0dp"
android:text="Image2" />
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Images
First the mipmap folders are for placing your app/launcher icons (which are shown on the homescreen) in only. Any other drawable assets you use should be placed in the relevant drawable folders.
Next since they will be in your drawables, I would just pass the #DrawableRes id e.g. the R.id.image_name value.
Intent intent = new Intent(this, Main2Activity.class);
intent.putExtra(IMAGE_RES_ID_KEY, R.id.imageName);
startActivity(intent);
Also I would recommend that you use a public static variable IMAGE_RES_ID_KEY for your extra key to avoid typos.
Then on the other side you can simply
if(getIntent().hasExtra(MainActivity.IMAGE_RES_ID_KEY)) {
imageView.setImageResource(getIntent().getIntExtra(MainActivity.IMAGE_RES_ID_KEY, 0));
}
I want to show my animated gif image in full size on the splash screen, but it's not working. I also used match parent. Whats the problem here? My xml file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_splashscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.foodie.splash.splashscreen">
<com.felipecsl.gifimageview.library.GifImageView
android:id="#+id/gifImageView"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:layout_marginRight="0dp"
android:layout_marginLeft="0dp"
android:layout_height="match_parent" />
</RelativeLayout>
And this is how it looks:
Java code:
package com.example.foodie.splash;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ProgressBar;
import com.felipecsl.gifimageview.library.GifImageView;
import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
public class splashscreen extends AppCompatActivity {
private GifImageView gifImageView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splashscreen);
gifImageView = (GifImageView)findViewById(R.id.gifImageView);
//Set GIFImageView resource
try{
InputStream inputStream = getAssets().open("foodie.gif");
byte[] bytes = IOUtils.toByteArray(inputStream);
gifImageView.setBytes(bytes);
gifImageView.startAnimation();
}
catch (IOException ex)
{
}
//Wait for 3 seconds and start Activity Main
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
splashscreen.this.startActivity(new Intent(splashscreen.this,MainActivity.class));
splashscreen.this.finish();
}
},5000); // 3000 = 3second
}
}
you choose a wrong scale type, sett the scaleType as FitXY instead of fit center
but of course it lead to change the scales, find out if it has something like centerCrop scale.
<com.felipecsl.gifimageview.library.GifImageView
android:id="#+id/gifImageView"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
JAVA:
package com.example.scott.testapplication;
import android.app.Activity;
import android.media.Image;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class HomeScreen extends Activity {
RelativeLayout Backround;
Button InitButton;
ImageView image;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_screen);
Backround = (RelativeLayout) findViewById(R.id.Backround);
InitButton = (Button) findViewById(R.id.InitButton);
image = (ImageView) findViewById(R.id.image);
InitButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
/*insert code here*/
}
});
}
}
In order to insert the image, i'm thinking that I need to use a command like ImageView image = new (image), and then use another command to draw it on the display. I dont know which commands I should use.
XML:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/Backround"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin">
<ImageView
android:layout_width ="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/image"
android:scaleType="fitXY"
android:src="#drawable/DESERT2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Initiate"
android:id="#+id/InitButton"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_vertical" />
</RelativeLayout>
I would like to create the image on the event of the click of a button, I also created the ImageView in the xml file. Not sure if I should change something there.
you can use
image.setImageResource(R.drawable.yourDesiredImageName);
Before I go into detail about the problem I have been having, I am quite new to android development so let me just explain what I would like to achieve and what I have tried to do.
I am creating an android app in eclipse IDE using the android 4.0 operating system and what I would like to create in this app is a windowed scrollview which contains various different widgets such as check boxes, text views and edit texts. These edit texts are required so that the user can input some data about an image that is displayed in an image view on the app page but is not inside the scroll view. The user would then press a button and that data would then be stored somewhere (i know what I want to do with that) and a new image would appear, then the process repeats.
Now in order to create a windowed scrollview, I understand that you need to define the widgets inside a scrollview and to be able to scroll down to them properly is by defining them inside a linear layout and then messing around with the margin top values in each widget in the activity xml file.
However, once i created these widgets tried testing, this is where I am running into some issues.
Firstly, if a widget is placed in between the header and footer ( the region displayed on the app page and used as part of the windowed scrollview) and i try and test out the scrolling, the scrolling works but it creates a random duplicate of that widget which I cannot get rid of e.g http://community.dur.ac.uk/cs.seg05/androidapp/exhibit_A.JPG (I can't display the image to you directly as i am not a high enough rank to display an image on StackOverflow)
In an attempt to try and fix this issue, I decided that I would move everything below the footer of the scrollview and then just scroll up from there and this seemed to have worked.
Unfortunately, when trying to test out inputs into my edit texts, I ran to another annoying problems.
As soon as I finish typing into an edit text and click the next button on the soft keyboard, the app directed me to another edit text which I had not defined and displayed another soft keyboard and this in turn created a duplicate of every widget (including that edit text) that was currently displayed inside the scrollview window. (i had scrolled up in order to get to this edit text) eg
https://community.dur.ac.uk/cs.seg05/androidapp/test.JPG
I then looked on questions such as Scrolling EditText on ScrollView programmatically , How to prevent auto scrolling of EditText when keyboard appears on Android? , Enable Scrolling within EditText that is in a ScrollView
but none of these are really helping me.
I have also tried using AutoTextCompleteView widgets as the widgets that the user woudl use as inputs but I do not fully understand how they work and I have not been able to get any data from them as when i type something into them, the program is returning that nothing has been typed.
I would really appreciate some help on this as I don't know if I am missing something, or if I have not set the widgets up correctly or if I have not set the scrollview correctly so if any of you have any solutions to these problems, please post them (code or a step by step would be very helpful).
Here is my java code in my activity (note that this a second activity that is launched once the first activity is completed).
package com.example.hello;
import android.app.Activity;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import android.os.Build;
import android.widget.AdapterView.OnItemClickListener;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONObject;
public class SecondActivity extends Activity {
private String userId; //global variable as it will be used throughout this activity
private ArrayList <String> imageNames;
private String directory="http://community.dur.ac.uk/cs.seg05/Wild/CameraImages/";
private int imageNumber=0;
private CheckBox humanTest;
private ArrayList<String> pictureIds;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
Bundle data = getIntent().getExtras(); //obtains information passed from the previous activity
userId= data.getString("userId"); //gets the user id from the main activity
System.err.println("Received User id " +userId);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
imageNames =getImages(userId); //gets all of the image names from the database
System.err.println(imageNames);
getNextImage(imageNumber, imageNames); //method that obtains the next image
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.second, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_second,
container, false);
return rootView;
}
}
public ArrayList<String> getImages(String userid) { // method that gets images from a php file
ArrayList<String> images= new ArrayList<String>();
pictureIds= new ArrayList<String> ();
try {
HttpClient httpclient= new DefaultHttpClient();
URI website= new URI("https://community.dur.ac.uk/cs.seg05/androidapp/ImageAccess.php?userid="+userid);
HttpGet request= new HttpGet();
request.setURI(website);
HttpResponse response = httpclient.execute(request);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb=new StringBuffer("");
String l= "";
String nl= System.getProperty("line.separator");
while ((l = reader.readLine()) != null) { //converts the whole output into a string
sb.append(l+ nl);
}
reader.close();
String result=sb.toString();
JSONArray jArray = new JSONArray(result);
System.err.println(jArray.length());
for(int i=0;i<jArray.length();i++){ //retrieves the JSon
JSONObject json_data = jArray.getJSONObject(i);
System.err.println(json_data);
images.add(json_data.getString("File_Name"));
pictureIds.add(json_data.getString("Picture_ID"));
}
}
catch (Exception e) {
System.err.println(e);
}
return images;
}
public static Bitmap getBitmapFromURL(String src) {
try {
java.net.URL url = new java.net.URL(src);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public void getNextImage(int number, ArrayList<String> images) { //method that gets the images
if (number>=images.size()) {
String whitespace="http://www.skettymethodistchurch.org.uk/whitespace.jpg" ; //whitespace for when user has finished the subset of images
Bitmap bm= getBitmapFromURL(whitespace);
ImageView iv= (ImageView)findViewById(R.id.imageView1); //gets the image view
iv.setImageBitmap(bm);
}
else {
String image=images.get(number);
String request=directory+image;
Bitmap bm= getBitmapFromURL(request);
ImageView iv= (ImageView)findViewById(R.id.imageView1); //gets the image view
iv.setImageBitmap(bm);
imageNumber++;
}
}
public void loadNextImage(View view) { //method for when the next button is clicked
try {
// humanTest = (CheckBox) findViewById(R.id.checkBox1);
ImageView iv= (ImageView)findViewById(R.id.imageView1); //gets the image view
iv.setImageBitmap(null);
getNextImage(imageNumber, imageNames);
}
catch (Exception e) {
System.err.println(e);
}
}
public void LoadHelpActivity(View view) {
Intent i = new Intent(getBaseContext(), HelpActivity.class);
startActivity(i);
}
public void getScore(View view) {
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
}
}
Here is the xml file associated with this activity:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="#+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.hello.SecondActivity"
tools:ignore="MergeRootFrame" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="315dp"
android:layout_height="150dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="38dp" />
<!-- Header aligned to top -->
<RelativeLayout
android:id="#+id/header"
android:layout_width="315dp"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center" >
<TextView
android:layout_width="355dp"
android:layout_height="25dp"
android:layout_marginTop="0dp"
android:text="Scroll up to classify the contents of the image"
android:textColor="#000"
android:textSize="14sp" />
</RelativeLayout>
<!-- Footer aligned to bottom -->
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
/>
</RelativeLayout>
<ScrollView
android:id="#+id/scrollableContents"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_above="#id/footer"
android:layout_below="#id/header"
android:isScrollContainer="false"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical" >
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:text="Humans in image" />
<EditText
android:id="#+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text"
android:layout_marginTop="30dp"
android:ems="13"
/>
<Button
android:id="#+id/button1"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_centerHorizontal="true"
android:onClick="loadNextImage"
android:text="#string/classify" />
</LinearLayout>
</ScrollView>
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:onClick="LoadHelpActivity"
android:text="Help" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignLeft="#+id/imageView1"
android:layout_alignParentTop="true"
android:layout_marginLeft="22dp"
android:onClick="getScore"
android:text="Check score" />
</RelativeLayout>
Finally, here is the android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="14" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.hello.MainActivity"
android:label="Wild Eyes" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.hello.SecondActivity"
android:label="Wild Eyes" >
</activity>
<activity
android:name="com.example.hello.HelpActivity"
android:label="Wild Eyes" >
</activity>
</application>
</manifest>
If there is anything that I have missed and that would be beneficial, do let me know and I will post it.
Thanks
Tom