No grammar constraints (DTD or XML schema) detected for the document 6

7331

New Member
I am making my exam in programming C on my gymnasium. My App chrashes every time i click on either "krypter" or "dekrypter" (they are two buttons).I get the above error in some diffent places in my code and cant figure out what the problem is. I have already looked at many other questions like this but none made me see the problem.The two activites is mostly identical and the same for the XML's.The code for one of the activities you can open from my main activity\[code\]public class Krypteringstype extends Activity {public Button slider;public Button krypterKnap;public EditText tekst;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.krypteringstype); // viser krypteringssiden slider = (Button) findViewById(R.id.handle); // forbinder xml-knappen og knappen "slider", som er defineret tidligere slider.getBackground().setAlpha(230); // g?r baggrunden, som jeg bruger let transparent //tekst = (EditText) findViewById(editText1); krypterKnap = (Button) findViewById(R.id.krypter); krypterKnap.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { krypterKnap(); } });}private void krypterKnap() { if (tekst.getText().equals("")){ Toast.makeText(getApplicationContext(), "Skriv tekst f?rst", Toast.LENGTH_LONG).show(); } else { konverter(); } }private void konverter(){ String initialString = "yourString"; char[] chars = initialString.toCharArray(); for (int i = 0; i < chars.length; ++i) chars = (char)((int)chars + 2);// String resultString = new String(chars);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.krypter, menu); return true;}}\[/code\]The XML for the activity above\[code\]<?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:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/blue_binary_code_1600_1200"tools:context=".Krypter" ><Button android:id="@+id/krypter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="15dp" android:layout_marginLeft="30dp" android:background="@drawable/background_large" android:gravity="center" android:minHeight="35dp" android:minWidth="100dp" android:text="@string/valg" android:textSize="20sp" /><Button android:id="@+id/standardKrypter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginBottom="15dp" android:layout_marginRight="30dp" android:background="@drawable/background_large" android:gravity="center" android:minHeight="35dp" android:minWidth="100dp" android:text="@string/standard" android:textSize="20sp" /><Button android:id="@+id/overskriftKrypter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="15dp" android:background="@drawable/background_large" android:minHeight="35dp" android:minWidth="250dp" android:text="@string/overskrift" android:textSize="20sp" /><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/krypter" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/overskriftKrypter" android:layout_marginBottom="15dp" android:layout_marginTop="15dp" > <SlidingDrawer android:id="@+id/slidingDrawerKrypter" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="1" android:content="@+id/content" android:handle="@+id/handle" > <Button android:id="@+id/handle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_large" android:minHeight="35dp" android:text="@string/ceasar" /> <LinearLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/button_background" > <EditText android:id="@+id/editText1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="@string/ceasarNr" android:inputType="number" > <requestFocus /> </EditText> </LinearLayout> </SlidingDrawer> <SlidingDrawer android:id="@+id/slidingDrawer2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:content="@+id/content" android:handle="@+id/handle" > <Button android:id="@+id/handle2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_large" android:minHeight="35dp" android:text="@string/abe" /> <LinearLayout android:id="@+id/content2" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/button_background" android:eek:rientation="vertical" > <EditText android:id="@+id/editText2" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/a" android:inputType="number" /> <EditText android:id="@+id/editText4" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/b" android:inputType="number" /> <EditText android:id="@+id/editText3" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/e" android:inputType="number" /> </LinearLayout> </SlidingDrawer> <SlidingDrawer android:id="@+id/slidingDrawer3" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:content="@+id/content" android:handle="@+id/handle" > <Button android:id="@+id/handle3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_large" android:minHeight="35dp" android:text="@string/rsa" /> <LinearLayout android:id="@+id/content3" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/button_background" android:eek:rientation="vertical" > <EditText android:id="@+id/editText5" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prim1" android:inputType="number" /> <EditText android:id="@+id/editText7" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prim2" android:inputType="number" /> <EditText android:id="@+id/editText6" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/k" android:inputType="number" /> </LinearLayout> </SlidingDrawer></LinearLayout>\[/code\]The code for the second activity you can open from my main activity\[code\]public class Dekrypteringstype extends Activity {public Button slider;public Button krypterKnap;public EditText tekst;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dekrypteringstype); // viser krypteringssiden slider = (Button) findViewById(R.id.handle); // forbinder xml-knappen og knappen "slider", som er defineret tidligere slider.getBackground().setAlpha(230); // g?r baggrunden, som jeg bruger let transparent //tekst = (EditText) findViewById(editText1); krypterKnap = (Button) findViewById(R.id.dekrypter); krypterKnap.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { krypterKnap(); } });}private void krypterKnap() { if (tekst.getText().equals("")){ Toast.makeText(getApplicationContext(), "Skriv tekst f?rst", Toast.LENGTH_LONG).show(); } else { konverter(); } }private void konverter(){ String initialString = "yourString"; char[] chars = initialString.toCharArray(); for (int i = 0; i < chars.length; ++i) chars = (char)((int)chars + 2);// String resultString = new String(chars);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.dekrypter, menu); return true;}\[/code\]}The XML for the activity above\[code\]<?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:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/blue_binary_code_1600_1200"tools:context=".Dekrypter" ><Button android:id="@+id/dekrypter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="15dp" android:layout_marginLeft="30dp" android:background="@drawable/background_large" android:gravity="center" android:minHeight="35dp" android:minWidth="100dp" android:text="@string/valg" android:textSize="20sp" /><Button android:id="@+id/standardDekrypter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginBottom="15dp" android:layout_marginRight="30dp" android:background="@drawable/background_large" android:gravity="center" android:minHeight="35dp" android:minWidth="100dp" android:text="@string/standard" android:textSize="20sp" /><Button android:id="@+id/overskriftDekrypter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="15dp" android:background="@drawable/background_large" android:minHeight="35dp" android:minWidth="250dp" android:text="@string/overskrift2" android:textSize="20sp" /><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/dekrypter" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/overskriftDekrypter" android:layout_marginBottom="15dp" android:layout_marginTop="15dp" > <SlidingDrawer android:id="@+id/slidingDrawerDekrypter" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="1" android:content="@+id/content" android:handle="@+id/handle" > <Button android:id="@+id/handle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_large" android:minHeight="35dp" android:text="@string/ceasar" /> <LinearLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/button_background" > <EditText android:id="@+id/editText1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="@string/ceasarNr" android:inputType="number" > <requestFocus /> </EditText> </LinearLayout> </SlidingDrawer> <SlidingDrawer android:id="@+id/slidingDrawer2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:content="@+id/content" android:handle="@+id/handle" > <Button android:id="@+id/handle2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_large" android:minHeight="35dp" android:text="@string/abe" /> <LinearLayout android:id="@+id/content2" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/button_background" android:eek:rientation="vertical" > <EditText android:id="@+id/editText2" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/a" android:inputType="number" /> <EditText android:id="@+id/editText4" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/b" android:inputType="number" /> <EditText android:id="@+id/editText3" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/e" android:inputType="number" /> </LinearLayout> </SlidingDrawer> <SlidingDrawer android:id="@+id/slidingDrawer3" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:content="@+id/content" android:handle="@+id/handle" > <Button android:id="@+id/handle3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_large" android:minHeight="35dp" android:text="@string/rsa" /> <LinearLayout android:id="@+id/content3" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/button_background" android:eek:rientation="vertical" > <EditText android:id="@+id/editText5" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prim1" android:inputType="number" /> <EditText android:id="@+id/editText7" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prim2" android:inputType="number" /> <EditText android:id="@+id/editText6" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/k" android:inputType="number" /> </LinearLayout> </SlidingDrawer></LinearLayout>\[/code\]
 
Top