Team:Bielefeld-CeBiTec/Software/SourceCode

iGEM Bielefeld 2015


de.anna.cellfreestickResults.java
Analysis.java
TakePhoto.java
HeavyMetals.java
Instructions.java
MainActivity.java
ContaminationList.java
HeavyMetalsFragment.java
HeavyMetalsDetailsActivity.java
HeavyMetalsDetailsFragment.java
<head>

layoutactivity_main.xml
activity_results.xml
simple_list_item.xml
activity_analysis.xml
activity_take_photo.xml
activity_instructions.xml
fragment_heavy_metals.xml
activity_contamination_list.xml
activity_heavy_metals_details.xml
fragment_heavy_metals_details.xml
<script> $("#sourcecode").addClass("navbar-active"); </script> <title>Analysis.java</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> .ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; } .s0 { color: rgb(0,0,128); font-weight: bold; } .s1 { } .s2 { color: rgb(128,128,128); font-style: italic; } </style> </head> <BODY BGCOLOR="#ffffff">

Analysis.java


<span class="s0">package </span><span class="s1">de.anna.cellfreestick; 
 
</span><span class="s0">import </span><span class="s1">android.support.v7.app.ActionBarActivity; 
</span><span class="s0">import </span><span class="s1">android.os.Bundle; 
</span><span class="s0">import </span><span class="s1">android.view.Menu; 
</span><span class="s0">import </span><span class="s1">android.view.MenuItem; 
 
 
</span><span class="s0">public class </span><span class="s1">Analysis </span><span class="s0">extends </span><span class="s1">ActionBarActivity { 
 
    @Override 
    </span><span class="s0">protected void </span><span class="s1">onCreate(Bundle savedInstanceState) { 
        </span><span class="s0">super</span><span class="s1">.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_analysis); 
    } 
 
    @Override 
    </span><span class="s0">public boolean </span><span class="s1">onCreateOptionsMenu(Menu menu) { 
        </span><span class="s2">// Inflate the menu; this adds items to the action bar if it is present.</span><span class="s1"> 
        getMenuInflater().inflate(R.menu.menu_analysis, menu); 
        </span><span class="s0">return true</span><span class="s1">; 
    } 
 
    @Override 
    </span><span class="s0">public boolean </span><span class="s1">onOptionsItemSelected(MenuItem item) { 
        </span><span class="s2">// Handle action bar item clicks here. The action bar will</span><span class="s1"> 
        </span><span class="s2">// automatically handle clicks on the Home/Up button, so long</span><span class="s1"> 
        </span><span class="s2">// as you specify a parent activity in AndroidManifest.xml.</span><span class="s1"> 
        </span><span class="s0">int </span><span class="s1">id = item.getItemId(); 
 
        </span><span class="s2">//noinspection SimplifiableIfStatement</span><span class="s1"> 
        </span><span class="s0">if </span><span class="s1">(id == R.id.action_settings) { 
            </span><span class="s0">return true</span><span class="s1">; 
        } 
 
        </span><span class="s0">return super</span><span class="s1">.onOptionsItemSelected(item); 
    } 
} 
</span>


</body>

<head> <title>ApplicationTest.java</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> .ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; } .s0 { color: rgb(0,0,128); font-weight: bold; } .s1 { } .s2 { color: rgb(128,128,128); font-style: italic; } .s3 { color: rgb(128,128,128); font-style: italic; } </style> </head> <BODY BGCOLOR="#ffffff">

ApplicationTest.java


<span class="s0">package </span><span class="s1">de.anna.cellfreestick; 
 
</span><span class="s0">import </span><span class="s1">android.app.Application; 
</span><span class="s0">import </span><span class="s1">android.test.ApplicationTestCase; 
 
</span><span class="s2">/** 
 * </span><span class="s3"><a href="http://d.android.com/tools/testing/testing_android.html"></span><span class="s2">Testing Fundamentals</span><span class="s3"></a></span><span class="s2"> 
 */</span><span class="s1"> 
</span><span class="s0">public class </span><span class="s1">ApplicationTest </span><span class="s0">extends </span><span class="s1">ApplicationTestCase<Application> { 
    </span><span class="s0">public </span><span class="s1">ApplicationTest() { 
        </span><span class="s0">super</span><span class="s1">(Application.</span><span class="s0">class</span><span class="s1">); 
    } 
}</span>

</body>

<head> <title>ContaminationList.java</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> .ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; } .s0 { color: rgb(0,0,128); font-weight: bold; } .s1 { } .s2 { color: rgb(128,128,128); font-style: italic; } .s3 { color: rgb(0,128,0); font-weight: bold; } .s4 { color: rgb(0,0,255); } </style> </head> <BODY BGCOLOR="#ffffff">

ContaminationList.java


<span class="s0">package </span><span class="s1">de.anna.cellfreestick; 
 
</span><span class="s0">import </span><span class="s1">android.content.DialogInterface; 
</span><span class="s0">import </span><span class="s1">android.content.Intent; 
</span><span class="s0">import </span><span class="s1">android.support.v7.app.ActionBarActivity; 
</span><span class="s0">import </span><span class="s1">android.os.Bundle; 
</span><span class="s0">import </span><span class="s1">android.view.Menu; 
</span><span class="s0">import </span><span class="s1">android.view.MenuItem; 
</span><span class="s0">import </span><span class="s1">android.view.View; 
</span><span class="s0">import </span><span class="s1">android.widget.Button; 
</span><span class="s0">import </span><span class="s1">android.widget.TableLayout; 
</span><span class="s0">import </span><span class="s1">android.widget.TextView; 
 
</span><span class="s0">import </span><span class="s1">java.util.Arrays; 
 
 
</span><span class="s0">public class </span><span class="s1">ContaminationList </span><span class="s0">extends </span><span class="s1">ActionBarActivity </span><span class="s0">implements </span><span class="s1">View.OnClickListener { 
 
    </span><span class="s2">//declaration of variables</span><span class="s1"> 
    </span><span class="s0">private int </span><span class="s1">[] medianpos; 
    </span><span class="s0">private int </span><span class="s1">[] medianneg; 
    </span><span class="s0">private boolean </span><span class="s1">[] contamination; 
    </span><span class="s0">private </span><span class="s1">TextView textViewException; 
    </span><span class="s0">private </span><span class="s1">TableLayout contaminationTable; 
    </span><span class="s0">private </span><span class="s1">Button details; 
    </span><span class="s0">private </span><span class="s1">Button about; 
 
    @Override 
    </span><span class="s0">protected void </span><span class="s1">onCreate(Bundle savedInstanceState) { 
        </span><span class="s0">super</span><span class="s1">.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_contamination_list); 
 
        </span><span class="s2">//find elements from View</span><span class="s1"> 
        details =(Button) findViewById(R.id.buttonDetails); 
        details.setOnClickListener(</span><span class="s0">this</span><span class="s1">); 
        about=(Button) findViewById(R.id.buttonAbout); 
        about.setOnClickListener(</span><span class="s0">this</span><span class="s1">); 
        textViewException =(TextView) findViewById(R.id.textViewException); 
        contaminationTable = (TableLayout) findViewById(R.id.contaminationTable); 
 
        </span><span class="s2">//store values from intent in variables for further calculations</span><span class="s1"> 
        Intent intent = getIntent(); 
        </span><span class="s0">if</span><span class="s1">(intent!=</span><span class="s0">null</span><span class="s1">){ 
            medianpos= intent.getIntArrayExtra(</span><span class="s3">"Keypos"</span><span class="s1">); 
            medianneg= intent.getIntArrayExtra(</span><span class="s3">"Keyneg"</span><span class="s1">); 
        } 
 
        </span><span class="s2">//call method for the calculation of contamination</span><span class="s1"> 
        calculateContamination(); 
 
        </span><span class="s2">//if contamination[false] remove corresponding heavy metal from table view</span><span class="s1"> 
       </span><span class="s0">for</span><span class="s1">(</span><span class="s0">int </span><span class="s1">i=</span><span class="s4">6</span><span class="s1">; i>=</span><span class="s4">0</span><span class="s1">; i--) { 
            </span><span class="s0">if</span><span class="s1">(!contamination[i]) contaminationTable.removeViewAt(i); 
        } 
    } 
 
    </span><span class="s2">//method for the calculation of contamination</span><span class="s1"> 
    </span><span class="s0">private void </span><span class="s1">calculateContamination() { 
        contamination = </span><span class="s0">new boolean</span><span class="s1">[</span><span class="s4">7</span><span class="s1">]; 
        </span><span class="s2">// check if positive control has a reasonable value, if not throw exception</span><span class="s1"> 
        </span><span class="s0">if</span><span class="s1">(medianneg[</span><span class="s4">0</span><span class="s1">]>=</span><span class="s4">20</span><span class="s1">){ 
 
            </span><span class="s2">/* calculation of correction factor because of hazardous metals in the sample 
            that could possibly lead to decrease in fluorescence 
             */</span><span class="s1"> 
 
            </span><span class="s0">float </span><span class="s1">corr = medianneg[</span><span class="s4">0</span><span class="s1">]/medianpos[</span><span class="s4">0</span><span class="s1">]; </span><span class="s2">//relative decrease of fluorescence in positive controls</span><span class="s1"> 
 
            </span><span class="s2">/*does the test reach more than ten percent of the positive control? 
            if that is the case the value corresponding to the certain heavy metal is set to 'true' in 
            contamination[] otherwise it is set to 'false' 
             */</span><span class="s1"> 
 
            </span><span class="s0">for</span><span class="s1">(</span><span class="s0">int </span><span class="s1">i=</span><span class="s4">0</span><span class="s1">; i<</span><span class="s4">7</span><span class="s1">; i++){ 
 
                </span><span class="s0">float </span><span class="s1">diff = corr*medianpos[i+</span><span class="s4">1</span><span class="s1">]-medianneg[i+</span><span class="s4">1</span><span class="s1">]; 
                </span><span class="s0">float </span><span class="s1">cont = diff/medianneg[</span><span class="s4">0</span><span class="s1">]; 
                </span><span class="s0">if</span><span class="s1">(cont<</span><span class="s4">0.1 </span><span class="s1">|| diff<</span><span class="s4">0</span><span class="s1">){ 
                    contamination[i]=</span><span class="s0">false</span><span class="s1">; 
                }</span><span class="s0">else</span><span class="s1">{ 
                    contamination[i]=</span><span class="s0">true</span><span class="s1">; 
                } 
            } 
            textViewException.setText(</span><span class="s3">"Your water is contaminated with:"</span><span class="s1">); 
        }</span><span class="s0">else</span><span class="s1">{ 
            textViewException.setText(</span><span class="s3">"The test is not working properly, sorry!"</span><span class="s1">); 
            </span><span class="s2">//Supress showing of heavy metals in table view</span><span class="s1"> 
            </span><span class="s0">for</span><span class="s1">(</span><span class="s0">int </span><span class="s1">i=</span><span class="s4">7</span><span class="s1">; i<</span><span class="s4">7</span><span class="s1">; i--) { 
             contaminationTable.removeViewAt(i); 
            } 
        } 
 
 
    } 
 
    @Override 
    </span><span class="s0">public boolean </span><span class="s1">onCreateOptionsMenu(Menu menu) { 
        </span><span class="s2">// Inflate the menu; this adds items to the action bar if it is present.</span><span class="s1"> 
        getMenuInflater().inflate(R.menu.menu_contamination_list, menu); 
        </span><span class="s0">return true</span><span class="s1">; 
    } 
 
    @Override 
    </span><span class="s0">public boolean </span><span class="s1">onOptionsItemSelected(MenuItem item) { 
        </span><span class="s2">// Handle action bar item clicks here. The action bar will</span><span class="s1"> 
        </span><span class="s2">// automatically handle clicks on the Home/Up button, so long</span><span class="s1"> 
        </span><span class="s2">// as you specify a parent activity in AndroidManifest.xml.</span><span class="s1"> 
        </span><span class="s0">int </span><span class="s1">id = item.getItemId(); 
 
        </span><span class="s2">//noinspection SimplifiableIfStatement</span><span class="s1"> 
        </span><span class="s0">if </span><span class="s1">(id == R.id.action_settings) { 
            </span><span class="s0">return true</span><span class="s1">; 
        } 
 
        </span><span class="s0">return super</span><span class="s1">.onOptionsItemSelected(item); 
    } 
 
    @Override 
    </span><span class="s0">public void </span><span class="s1">onClick(View v) { 
        </span><span class="s0">if</span><span class="s1">(v.getId() == R.id.buttonDetails){ 
 
            Intent intent = </span><span class="s0">new </span><span class="s1">Intent(ContaminationList.</span><span class="s0">this</span><span class="s1">, <a href="Results.java.html">Results</a>.</span><span class="s0">class</span><span class="s1">); 
            startActivity(intent); 
 
        }</span><span class="s0">else if</span><span class="s1">(v.getId() == R.id.buttonAbout){ 
 
            Intent intent = </span><span class="s0">new </span><span class="s1">Intent (ContaminationList.</span><span class="s0">this</span><span class="s1">, <a href="Analysis.java.html">Analysis</a>.</span><span class="s0">class</span><span class="s1">); 
            startActivity(intent); 
 
        } 
 
    } 
} 
</span>

</body> </html>

HeavyMetals.java

HeavyMetals.java

package de.anna.cellfreestick; 
 
/** 
 * Created by iGEM-Bielefeld on 30.08.2015. 
 */ 
public class HeavyMetals { 
 
    //declaration of variables 
    private String title; 
    private String content; 
 
    //constructs a simple list element for one of our analytes 
    public HeavyMetals(String title, String content) { 
        this.title = title; 
        this.content = content; 
    } 
 
    public String getTitle() { 
        return title; 
    } 
 
    public void setTitle(String title) { 
        this.title = title; 
    } 
 
    public String getContent() { 
        return content; 
    } 
 
    public void setContent(String content) { 
        this.content = content; 
    } 
 
    @Override 
    public String toString() { 
        return title; 
    } 
} 

HeavyMetalsDetailsActivity.java

HeavyMetalsDetailsActivity.java

package de.anna.cellfreestick; 
 
import android.support.v7.app.ActionBarActivity; 
import android.os.Bundle; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.widget.EditText; 
import android.widget.TextView; 
 
 
//Screen that shows you details about the different analytes 
public class HeavyMetalsDetailsActivity extends ActionBarActivity { 
    //Declaration of variables 
    String title; 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_heavy_metals_details); 
 
        //find View elements 
        title = getIntent().getStringExtra("value_title"); 
        TextView titleHeavyMetals = (TextView) findViewById(R.id.titleHeavyMetal); 
        titleHeavyMetals.setText(title); 
        TextView textHeavyMetals = (TextView) findViewById(R.id.textHeavyMetal); 
        textHeavyMetals.setText(addText(title)); 
 
    } 
 
    //Adds text to the view depending on the title 
   private String addText(String title) { 
       String mTitle; 
        switch (title) { 
            case "Arsenic": 
                mTitle = getResources().getString(R.string.Arsenic); 
            break; 
            case "Date rape drugs": 
                mTitle = getResources().getString(R.string.date_rape_drugs); 
            break; 
            case "Mercury": 
                mTitle = getResources().getString(R.string.Mercury); 
            break; 
            case "Chromium": 
                mTitle = getResources().getString(R.string.Chromium); 
            break; 
            case "Lead": 
                mTitle = getResources().getString(R.string.Lead); 
            break; 
            case "Nickel": 
                mTitle = getResources().getString(R.string.Nickel); 
            break; 
            case "Copper": 
                mTitle = getResources().getString(R.string.Copper); 
            break; 
            default: 
                mTitle = "you did not click an valid item!"; 
            break; 
 
        } 
 
       return mTitle; 
    } 
 
 
 
 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        // Inflate the menu; this adds items to the action bar if it is present. 
        getMenuInflater().inflate(R.menu.menu_heavy_metals_details, 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(); 
 
        //noinspection SimplifiableIfStatement 
        if (id == R.id.action_settings) { 
            return true; 
        } 
 
        return super.onOptionsItemSelected(item); 
    } 
} 

HeavyMetalsDetailsFragment.java

HeavyMetalsDetailsFragment.java

package de.anna.cellfreestick; 
 
 
import android.os.Bundle; 
import android.app.Fragment; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
import android.widget.TextView; 
 
 
/** 
 * A simple {@link Fragment} subclass. 
 * Use the {@link HeavyMetalsDetailsFragment#newInstance} factory method to 
 * create an instance of this fragment. 
 */ 
 
//default Fragment 
public class HeavyMetalsDetailsFragment extends Fragment { 
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 
    private static final String ARG_PARAM1 = "param1"; 
    private static final String ARG_PARAM2 = "param2"; 
 
 
    private String mParam1; 
    private String mParam2; 
 
 
    public static HeavyMetalsDetailsFragment newInstance(String param1, String param2) { 
        HeavyMetalsDetailsFragment fragment = new HeavyMetalsDetailsFragment(); 
        Bundle args = new Bundle(); 
        args.putString(ARG_PARAM1, param1); 
        args.putString(ARG_PARAM2, param2); 
        fragment.setArguments(args); 
        return fragment; 
    } 
 
    public HeavyMetalsDetailsFragment() { 
        // Required empty public constructor 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        if (getArguments() != null) { 
            mParam1 = getArguments().getString(ARG_PARAM1); 
            mParam2 = getArguments().getString(ARG_PARAM2); 
        } 
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
                             Bundle savedInstanceState) { 
        // Inflate the layout for this fragment 
        return inflater.inflate(R.layout.fragment_heavy_metals_details, container, false); 
    } 
 
} 

HeavyMetalsFragment.java

HeavyMetalsFragment.java

package de.anna.cellfreestick; 
 
import android.app.Activity; 
import android.content.Intent; 
import android.os.Bundle; 
import android.app.ListFragment; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
import android.widget.ArrayAdapter; 
import android.widget.ListView; 
 
 
import java.util.ArrayList; 
import java.util.List; 
 
 
/** 
 * A fragment representing a list of Items. 
 * Activities containing this fragment MUST implement the {@link OnFragmentInteractionListener} 
 * interface. 
 */ 
 
//default list fragment 
public class HeavyMetalsFragment extends ListFragment { 
 
   // declaration of variables 
    private static final String ARG_PARAM1 = "param1"; 
    private static final String ARG_PARAM2 = "param2"; 
 
    private String mParam1; 
    private String mParam2; 
    private OnFragmentInteractionListener mListener; 
 
 
    //establishment of a new instance of the List 
    public static HeavyMetalsFragment newInstance(String param1, String param2) { 
        HeavyMetalsFragment fragment = new HeavyMetalsFragment(); 
        Bundle args = new Bundle(); 
        args.putString(ARG_PARAM1, param1); 
        args.putString(ARG_PARAM2, param2); 
        fragment.setArguments(args); 
        return fragment; 
    } 
 
    /** 
     * Mandatory empty constructor for the fragment manager to instantiate the 
     * fragment (e.g. upon screen orientation changes). 
     */ 
    public HeavyMetalsFragment() { 
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
 
        if (getArguments() != null) { 
            mParam1 = getArguments().getString(ARG_PARAM1); 
            mParam2 = getArguments().getString(ARG_PARAM2); 
        } 
 
        //creation of a new list with HeavyMetal instances 
        List<HeavyMetals> heavyMetalsList = new ArrayList<HeavyMetals>(); 
 
        //hardcoded filling of the list with our analytes 
        heavyMetalsList.add(new HeavyMetals("Date rape drugs","a")); 
        heavyMetalsList.add(new HeavyMetals("Arsenic", "b")); 
        heavyMetalsList.add(new HeavyMetals("Mercury","c")); 
        heavyMetalsList.add(new HeavyMetals("Chromium","d")); 
        heavyMetalsList.add(new HeavyMetals("Lead","e")); 
        heavyMetalsList.add(new HeavyMetals("Nickel","f")); 
        heavyMetalsList.add(new HeavyMetals("Copper","g")); 
 
        //set list adapter 
       setListAdapter(new ArrayAdapter<HeavyMetals>(getActivity(), 
        R.layout.simple_list_item, android.R.id.text1, heavyMetalsList)); 
    } 
 
 
    @Override 
    public void onAttach(Activity activity) { 
        super.onAttach(activity); 
        try { 
            mListener = (OnFragmentInteractionListener) activity; 
        } catch (ClassCastException e) { 
            throw new ClassCastException(activity.toString() 
                    + " must implement OnFragmentInteractionListener"); 
        } 
    } 
 
    @Override 
    public void onDetach() { 
        super.onDetach(); 
        mListener = null; 
    } 
 
    @Override 
    public void onListItemClick(ListView l, View v, int position, long id) { 
        super.onListItemClick(l, v, position, id); 
 
        //addition of title to intent 
        Intent intent = new Intent(getActivity(),HeavyMetalsDetailsActivity.class); 
        String title = l.getItemAtPosition(position).toString(); 
        intent.putExtra("value_title", title); 
        getActivity().startActivity(intent); 
 
        if (null != mListener) { 
            // Notify the active callbacks interface (the activity, if the 
            // fragment is attached to one) that an item has been selected. 
            //mListener.onFragmentInteraction(DummyContent.ITEMS.get(position).id); 
        } 
    } 
 
    /** 
     * This interface must be implemented by activities that contain this 
     * fragment to allow an interaction in this fragment to be communicated 
     * to the activity and potentially other fragments contained in that 
     * activity. 
     * <p/> 
     * See the Android Training lesson <a href= 
     * "http://developer.android.com/training/basics/fragments/communicating.html" 
     * >Communicating with Other Fragments</a> for more information. 
     */ 
    public interface OnFragmentInteractionListener { 
 
        public void onFragmentInteraction(String id); 
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
        return inflater.inflate(R.layout.fragment_heavy_metals, container, false); 
    } 
} 

Instructions.java

Instructions.java

package de.anna.cellfreestick; 
 
import android.app.ActionBar; 
import android.content.Intent; 
import android.net.Uri; 
import android.os.Environment; 
import android.provider.MediaStore; 
import android.support.v7.app.ActionBarActivity; 
import android.os.Bundle; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.view.View; 
import android.widget.Button; 
 
import java.io.File; 
 
 
public class Instructions extends ActionBarActivity implements View.OnClickListener { 
 
    //declaration of variables 
    Button buttonTakePhotoInstructions; 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_instructions); 
 
        //find view elements 
        buttonTakePhotoInstructions = (Button) findViewById(R.id.buttonTakePhotoInstructions); 
        buttonTakePhotoInstructions.setOnClickListener(this); 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        // Inflate the menu; this adds items to the action bar if it is present. 
        getMenuInflater().inflate(R.menu.menu_instructions2, 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(); 
 
        //noinspection SimplifiableIfStatement 
        if (id == R.id.action_settings) { 
            return true; 
        } 
 
        return super.onOptionsItemSelected(item); 
    } 
 
    @Override 
    public void onClick(View view) { 
 
        //define intent upon click on button 
        Intent intent = new Intent (this, TakePhoto.class); 
        startActivity(intent); 
    } 
 
} 

MainActivity.java

MainActivity.java

package de.anna.cellfreestick; 
 
import android.app.ActionBar; 
import android.app.Activity; 
import android.content.ContentValues; 
import android.content.Intent; 
import android.graphics.Bitmap; 
import android.net.Uri; 
import android.os.Environment; 
import android.provider.MediaStore; 
import android.support.v7.app.ActionBarActivity; 
import android.os.Bundle; 
import android.util.Log; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.Button; 
import android.widget.ImageView; 
 
import java.io.File; 
import java.io.IOException; 
 
 
public class MainActivity extends Activity implements OnClickListener { 
 
    public Button buttonInstructions; 
    public Button buttonTakePhoto; 
 
 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_main); 
 
        //find View elements 
        buttonInstructions = (Button)findViewById(R.id.buttonInstructions); 
        buttonTakePhoto = (Button)findViewById(R.id.buttonTakePhoto); 
        buttonInstructions.setOnClickListener (this); 
        buttonTakePhoto.setOnClickListener(this); 
 
 
    } 
 
    //define intents for buttons 
    public void onClick(View v){ 
        if(v.getId() == R.id.buttonInstructions){ 
            Intent intent = new Intent(MainActivity.this, Instructions.class); 
            startActivity(intent); 
 
        }else if(v.getId() == R.id.buttonTakePhoto){ 
 
            Intent intent = new Intent (MainActivity.this, TakePhoto.class); 
            startActivity(intent); 
 
        } 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        // Inflate the menu; this adds items to the action bar if it is present. 
        getMenuInflater().inflate(R.menu.menu_main, 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(); 
 
        //noinspection SimplifiableIfStatement 
        if (id == R.id.action_settings) { 
            return true; 
        } 
 
        return super.onOptionsItemSelected(item); 
    } 
 
 
 
} 
Results.java
Results.java

package de.anna.cellfreestick; 
 
import android.content.Intent; 
import android.graphics.Color; 
import android.support.v7.app.ActionBarActivity; 
import android.os.Bundle; 
import android.util.Log; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.view.View; 
import android.widget.Button; 
import android.widget.Space; 
import android.widget.TextView; 
 
import java.util.Arrays; 
 
 
public class Results extends ActionBarActivity implements HeavyMetalsFragment.OnFragmentInteractionListener{ 
 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_results); 
 
        //implement list of heavymetals in layout 
        getFragmentManager().beginTransaction() 
                .replace(R.id.fragment2, HeavyMetalsFragment.newInstance("a","b")) 
                .commit(); 
 
 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        // Inflate the menu; this adds items to the action bar if it is present. 
        getMenuInflater().inflate(R.menu.menu_results, 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(); 
 
        //noinspection SimplifiableIfStatement 
        if (id == R.id.action_settings) { 
            return true; 
        } 
 
        return super.onOptionsItemSelected(item); 
    } 
 
    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
        super.onActivityResult(requestCode, resultCode, data); 
    } 
 
    @Override 
    public void onFragmentInteraction(String id) { 
 
    } 
} 
TakePhoto.java
TakePhoto.java

package de.anna.cellfreestick; 
 
import android.content.ContentValues; 
import android.content.Intent; 
import android.graphics.Bitmap; 
import android.graphics.Color; 
import android.graphics.PixelFormat; 
import android.net.Uri; 
import android.provider.MediaStore; 
import android.support.v7.app.ActionBarActivity; 
import android.os.Bundle; 
import android.util.Log; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.view.View; 
import android.widget.Button; 
import android.widget.ImageView; 
import android.widget.ListView; 
import android.widget.TextView; 
 
import java.io.IOException; 
import java.lang.reflect.Array; 
import java.util.Arrays; 
 
import static android.graphics.Color.parseColor; 
 
 
public class TakePhoto extends ActionBarActivity implements View.OnClickListener{ 
 
    //declaration of variables 
    private Button buttonResults; 
    private ImageView imageViewPhoto; 
    private TextView pixelanzeige; 
    private Uri imageUri; 
    private static final String TITLE = "TakePhoto"; 
    private static final String DESCRIPTION = "Foto taken by App"; 
    private static final String TAG = MainActivity.class.getSimpleName(); 
    private static final int IMAGE_CAPTURE = 1; 
    private Bitmap bitmap3; 
    private int [] medianpos = new int[8]; 
    private int [] medianneg = new int[8]; 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_take_photo); 
 
        //find view elements 
        buttonResults = (Button) findViewById(R.id.buttonResults); 
        buttonResults.setOnClickListener(this); 
        imageViewPhoto = (ImageView) findViewById(R.id.imageViewPhoto); 
 
        //take a picture and save it 
        startCamera(); 
 
    } 
 
    //starts the camera 
    private void startCamera(){ 
        ContentValues values = new ContentValues(); 
        values.put(MediaStore.Images.Media.TITLE, TITLE); 
        values.put(MediaStore.Images.Media.DESCRIPTION, DESCRIPTION); 
        values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); 
        imageUri = getContentResolver().insert( 
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); 
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
        intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); 
        startActivityForResult(intent, IMAGE_CAPTURE); 
    } 
 
    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
        super.onActivityResult(requestCode, resultCode, data); 
        if (requestCode == IMAGE_CAPTURE) { 
            if (resultCode == RESULT_OK) { 
                try { 
 
                    //create Bitmap from saved picture 
                    Bitmap bitmapRRR = MediaStore.Images.Media.getBitmap( 
                            getContentResolver(), imageUri); 
                    float w1 = bitmapRRR.getWidth(); 
                    float h1 = bitmapRRR.getHeight(); 
                    int h2 = 300; 
                    int w2 = (int) (w1 / h1 * (float) h2); 
                    bitmap3 = Bitmap.createScaledBitmap(bitmapRRR, w2, h2, false); 
 
                    //calculate the green values of examined pixels 
                    calculationGreen(); 
 
                    //show altered picture 
                    imageViewPhoto.setImageBitmap(bitmap3); 
 
                } catch (IOException e) { 
                    Log.e(TAG, "setBitmap()", e); 
                } 
            } else { 
                int rowsDeleted = getContentResolver().delete(imageUri, null, null); 
                Log.d(TAG, rowsDeleted + " rows deleted"); 
            } 
        } 
 
    } 
 
    //calculation of the median of the green values of the examined pixels 
    private void calculationGreen() { 
        int[] pixelwerte = new int[100]; 
        int[] pixelwerteGreen = new int[100]; 
        int l1=0; 
        int l2=0; 
 
 
        for (int n = 1; n < 4; n = n + 2){ 
            for (int m = 1; m < 9; m++) { 
                int k = 0; 
                for (int i = 0; i < 10; i++) { 
                    for (int j = 0; j < 10; j++) { 
                        pixelwerte[k] = bitmap3.getPixel(m * (bitmap3.getWidth() / 9) + i, n * (bitmap3.getHeight() / 4) + j); 
                        pixelwerteGreen[k] = Color.green(pixelwerte[k]); 
                        k++; 
                        bitmap3.setPixel(m * (bitmap3.getWidth() / 9) + i, n * (bitmap3.getHeight() / 4) + j, 0xffff0000); 
                    } 
                } 
 
                //calculation of median of green values 
                Arrays.sort(pixelwerteGreen); 
                if (n == 1){ medianpos[l1] = pixelwerteGreen[pixelwerteGreen.length / 2]; 
                    l1++; 
                }else {medianneg[l2]=pixelwerteGreen[pixelwerteGreen.length/2];l2++;} 
 
            } 
    } 
 
        pixelanzeige = (TextView) findViewById(R.id.pixelanzeige); 
        pixelanzeige.setText("Please check if the red square in the left bottom corner is inside the green circle! If this is not the case, take a new picture. The calculated values for the green color of the spots: " + Arrays.toString(medianpos) + Arrays.toString(medianneg)); 
 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        // Inflate the menu; this adds items to the action bar if it is present. 
        getMenuInflater().inflate(R.menu.menu_take_photo, 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(); 
 
        //noinspection SimplifiableIfStatement 
        if (id == R.id.action_settings) { 
            return true; 
        } 
 
        return super.onOptionsItemSelected(item); 
    } 
 
    @Override 
    public void onClick(View view) { 
        Intent intent = new Intent(this, ContaminationList.class); 
        //String inhalt = Arrays.toString(medianpos) + Arrays.toString(medianneg); 
        intent.putExtra("Keyneg", medianneg); 
        intent.putExtra("Keypos", medianpos); 
 
        startActivity(intent); 
    } 
 
 
} 

activity_analysis.xml

activity_analysis.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context="de.anna.cellfreestick.Analysis" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat"> 
 
    <TextView android:text="@string/analysis" android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:id="@+id/textAnalysis" 
        android:gravity="center_horizontal" 
        android:textColor="#ffffffff"/> 
 
    <ScrollView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/scrollView" 
        android:layout_alignParentBottom="true" /> 
 
</RelativeLayout> 
activity_contamination_list.xml
activity_contamination_list.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context="de.anna.cellfreestick.ContaminationList" 
    style="@style/Base.Theme.AppCompat" 
    android:background="#ff322f32" 
     > 
 
    <TextView 
        android:textColor="#ffffffff" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="@string/title_activity_contamination_list" 
        android:id="@+id/textViewContaminationList" 
        android:layout_column="1" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:textSize="60sp" 
        android:textStyle="bold" /> 
 
    <TableLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_alignParentStart="true" 
        android:id="@+id/contaminationTable" 
        android:layout_alignParentBottom="true" 
        android:layout_below="@+id/textViewException"> 
 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent" 
            android:id="@+id/dateRapeDrugs"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text= "Date rape drugs" 
                android:textSize="30sp" 
                android:id="@+id/textViewDateRapeDrugs" 
                android:layout_column="2" 
                /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:id="@+id/imageViewDateRapeDrugs" 
                android:layout_column="1"/> 
        </TableRow> 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent" 
            android:id="@+id/arsenic"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="Arsenic" 
                android:textSize="30sp" 
                android:layout_column="2" 
                android:id="@+id/textViewArsenic" /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_column="1" 
                android:id="@+id/imageViewArsenic" /> 
        </TableRow> 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="Mercury" 
                android:textSize="30sp" 
                android:layout_column="2" 
                android:id="@+id/textViewMercury" /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_column="1" 
                android:id="@+id/imageViewMercury" /> 
        </TableRow> 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="Chromium" 
                android:textSize="30sp" 
                android:layout_column="2" 
                android:id="@+id/textViewChromium" /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_column="1" 
                android:id="@+id/imageViewChromium" /> 
        </TableRow> 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="Lead" 
                android:textSize="30sp" 
                android:layout_column="2" 
                android:id="@+id/textViewLead" /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_column="1" 
                android:id="@+id/imageViewLead" /> 
        </TableRow> 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="Nickel" 
                android:textSize="30sp" 
                android:layout_column="2" 
                android:id="@+id/textViewNickel" /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_column="1" 
                android:id="@+id/imageViewNickel" /> 
        </TableRow> 
 
        <TableRow 
            android:layout_width="match_parent" 
            android:layout_height="match_parent"> 
 
            <TextView 
                android:textColor="#ffffffff" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="Copper" 
                android:textSize="30sp" 
                android:layout_column="2" 
                android:id="@+id/textViewCopper" /> 
 
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_column="1" 
                android:id="@+id/imageViewCopper" /> 
        </TableRow> 
    </TableLayout> 
 
    <TextView 
        android:textColor="#ffffffff" 
        android:textSize="30sp" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="May you always drink the purest of all waters!" 
        android:id="@+id/textViewException" 
        android:layout_alignParentEnd="true" 
        android:layout_below="@+id/textViewContaminationList" /> 
 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="About" 
        android:id="@+id/buttonAbout" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentLeft="true" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" 
        android:background="#ffe31918" 
        android:minWidth="140dp" 
        android:clickable="true" /> 
 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Details" 
        android:id="@+id/buttonDetails" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentRight="true" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" 
        android:background="#ffe31918" 
        android:minWidth="140dp" 
        android:clickable="true" /> 
 
</RelativeLayout> 
activity_heavy_metals_details.xml
activity_heavy_metals_details.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="de.anna.cellfreestick.HeavyMetalsDetailsActivity" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat"> 
 
    <fragment 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:name="de.anna.cellfreestick.HeavyMetalsDetailsFragment" 
        android:id="@+id/fragment" 
        android:layout_centerVertical="true" 
        android:layout_centerHorizontal="true" 
        tools:layout="@layout/fragment_heavy_metals_details" /> 
</RelativeLayout> 
activity_instructions.xml
activity_instructions.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" tools:context="de.anna.cellfreestick.Instructions" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat"> 
 
 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="Instructions" 
        android:id="@+id/textViewInstruction" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:textSize="60sp" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" /> 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="@string/textInstruction1" 
        android:id="@+id/textInstruction1" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:textSize="30sp" 
        android:layout_marginTop="80dp" 
        android:layout_marginLeft="20dp" 
        android:layout_marginRight="20dp" 
        android:textColor="#ffffffff" 
        android:textIsSelectable="false" 
        android:textStyle="bold" /> 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="@string/textInstruction2" 
        android:id="@+id/textInstruction2" 
        android:layout_below="@+id/textInstruction1" 
        android:layout_centerHorizontal="true" 
        android:textSize="30sp" 
        android:layout_marginTop="15dp" 
        android:layout_marginLeft="20dp" 
        android:layout_marginRight="20dp" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" /> 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="@string/textInstruction3" 
        android:id="@+id/textInstruction3" 
        android:textSize="30sp" 
        android:layout_marginLeft="20dp" 
        android:layout_marginRight="20dp" 
        android:layout_below="@+id/textInstruction2" 
        android:layout_alignParentStart="true" 
        android:layout_marginTop="20dp" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" /> 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="@string/textInstruction4" 
        android:id="@+id/textInstruction4" 
        android:layout_below="@+id/textInstruction3" 
        android:layout_centerHorizontal="true" 
        android:textSize="30sp" 
        android:layout_marginTop="20dp" 
        android:layout_marginLeft="20dp" 
        android:layout_marginRight="20dp" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" /> 
 
 
 
    <Button 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/buttonTakePhotoInstructions" 
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true" 
        android:layout_marginBottom="15dp" 
        android:layout_marginLeft="15dp" 
        android:layout_marginRight="15dp" 
 
        android:text="@string/buttonTakePhotoInstruction" 
        android:height="20sp" 
        android:minWidth="140dp" 
        android:background="#ffe31918" 
        android:textColor="#ffffffff" 
        android:textSize="30sp" 
        android:textStyle="bold" 
        android:clickable="true" /> 
 
</RelativeLayout> 
activity_main.xml
activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat"> 
 
    <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageLogo" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:src="@mipmap/colilogo" 
        android:contentDescription="@string/imageLogo" /> 
 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/buttonInstruction" 
        android:id="@+id/buttonInstructions" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentStart="true" 
        android:height="20sp" 
        android:layout_marginLeft="15dp" 
        android:layout_marginBottom="15dp" 
        android:background="#ffe31918" 
        style="@style/Base.ThemeOverlay.AppCompat.Dark" 
        android:ellipsize="end" 
        android:enabled="true" 
        android:elegantTextHeight="true" 
        android:minWidth="140sp" 
        android:textColor="#ffffffff" 
        android:textSize="15sp" 
        android:textStyle="bold" 
        android:clickable="true" /> 
 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/buttonTakePhoto" 
        android:id="@+id/buttonTakePhoto" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentEnd="true" 
        android:height="10sp" 
        android:layout_marginBottom="15dp" 
        android:layout_marginRight="15dp" 
        android:background="#ffe31918" 
        android:layout_alignParentLeft="false" 
        android:minWidth="140sp" 
        android:textColor="#ffffffff" 
        android:textSize="15sp" 
        android:textStyle="bold" 
        android:clickable="true" /> 
 
</RelativeLayout> 

activity_results.xml

activity_results.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context="de.anna.cellfreestick.Results" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat"> 
 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="@string/textViewResults" 
        android:id="@+id/textViewResults" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:textSize="60sp" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" /> 
 
    <fragment 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:name="de.anna.cellfreestick.HeavyMetalsFragment" 
        android:id="@+id/fragment2" 
        tools:layout="@android:layout/simple_list_item_1" 
        android:layout_centerInParent="true" 
        android:textColor="#ffffffff" 
         /> 
 
    <ImageView 
        android:id="@+id/icon" 
        android:layout_width="22px" 
        android:layout_height="22px" 
        android:layout_marginLeft="4px" 
        android:layout_marginRight="10px" 
        android:layout_marginTop="4px" 
        android:src="@drawable/logo" > 
    </ImageView> 
 
</RelativeLayout> 

activity_take_photo.xml

activity_take_photo.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context="de.anna.cellfreestick.TakePhoto" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat"> 
 
    <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/imageViewPhoto" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:layout_marginTop="20dp" 
 
        android:layout_marginBottom="300dp" 
        android:focusable="false" 
        android:layout_marginRight="20dp" 
        android:layout_marginLeft="20dp" /> 
 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/buttonResults" 
        android:id="@+id/buttonResults" 
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true" 
        android:layout_marginBottom="15dp" 
        android:background="#ffe31918" 
        android:height="20sp" 
        android:minWidth="140dp" 
        android:textColor="#ffffffff" 
        android:textStyle="bold" 
        android:clickable="true" /> 
 
    <TextView 
        android:textSize="20sp" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="New Text" 
        android:id="@+id/pixelanzeige" 
        android:layout_above="@+id/buttonResults" 
        android:textColor="#ffffffff" /> 
</RelativeLayout> 

fragment_heavy_metals.xml

fragment_heavy_metals.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#ff322f32"> 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:textSize="40sp" 
        android:textStyle="bold" 
        android:text="Details about:" 
        android:textColor="#ffffffff" 
        android:id="@+id/textViewHeavyMetalsInfo" 
        android:layout_gravity="center_horizontal" /> 
 
    <ListView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@android:id/list" 
        android:divider="#ffffffff" 
        android:dividerHeight="2px" 
        android:layout_marginTop="10dp" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:background="#ff322f32" 
        style="@style/Base.Theme.AppCompat"/> 
 
 
 
</LinearLayout>
fragment_heavy_metals_details.xml
fragment_heavy_metals_details.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="de.anna.cellfreestick.MainActivity" 
    android:gravity="top" 
    android:background="#ff322f32" 
    style="@style/Base.Theme.AppCompat" 
    android:padding="20sp"> 
 
 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:text="Large Text" 
        android:id="@+id/titleHeavyMetal" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:textSize="60sp" 
        android:textStyle="bold" 
        android:textColor="#ffffffff" /> 
 
    <TextView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/textHeavyMetal" 
        android:layout_centerHorizontal="true" 
        android:layout_below="@+id/titleHeavyMetal" 
        android:text="Line1: \n-Line2\n-Line3\n-Line4\n-Line5\n-Line6\n-Line7\n-Line8\n-Line9\n-Line10\-Line11\n-Line12\n-Line13\n-Line14 " 
        android:textSize="20sp" 
        android:textColor="#ffffffff" 
        android:layout_marginTop="20dp" 
        /> 
</RelativeLayout> 
simple_list_item.xml
simple_list_item.xml

<?xml version="1.0" encoding="utf-8"?> 
    <TextView  xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@android:id/text1" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:padding="10dp" 
        android:textSize="30sp" 
        android:textColor="#ffffffff" 
 
        > 
    </TextView>