Adding Form Widgets / XML Formatting causes Button to not start activity

hfalk

New Member
I have an XML file which upon clicking the save button at the bottom - successfully launched a new activity. The only changes I have made were adding new Form Widgets above the save button - and it no longer loads the other activity. CURRENT (NON WORKING XML)\[code\]<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"><LinearLayout android:id="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="5dp"> <EditText android:id="@+id/nameEdit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:imeOptions="actionNext" android:hint="@string/name_hint" android:inputType="textPersonName|textCapWords"/> <EditText android:id="@+id/capEdit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:imeOptions="actionNext" android:hint="@string/cap_hint" android:inputType="textPersonName|textCapWords"/> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Unlimited Bandwidth and Data" android:textAppearance="?android:attr/textAppearanceMedium" /> <ToggleButton android:id="@+id/saveBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /><TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Data Limit" android:textColor="#ffffff" android:textAppearance="?android:textAppearanceMedium" /><SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_height="wrap_content" /><LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="left" android:textColor="#ffffff" android:text="10MB" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="right" android:textColor="#ffffff" android:text="Unlimited" /></LinearLayout><TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Bandwidth Limit" android:textColor="#ffffff" android:textAppearance="?android:textAppearanceMedium" /><SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_height="wrap_content" /><LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="left" android:textColor="#ffffff" android:text="10kbs" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:textColor="#ffffff" android:gravity="right" android:text="Unlimited" /></LinearLayout><TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:textAppearanceSmall" /><TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="WiFi Time Limit" android:textColor="#ffffff" android:textAppearance="?android:textAppearanceMedium" /><TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:layout_weight="1.0" /><EditText android:id="@+id/codeEdit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:ems="10" android:hint="@string/code_hint" android:imeOptions="actionNext" /><TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Access Level" android:textAppearance="?android:attr/textAppearanceMedium" /><RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" /><TextView android:id="@+id/textView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Parental Controls" android:textAppearance="?android:attr/textAppearanceMedium" /><ToggleButton android:id="@+id/toggleButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Parental Controls" /><TextView android:id="@+id/textView6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Block Streaming" android:textAppearance="?android:attr/textAppearanceMedium" /><ToggleButton android:id="@+id/toggleButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /><TextView android:id="@+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Block File Type/Size" android:textAppearance="?android:attr/textAppearanceMedium" /><ToggleButton android:id="@+id/toggleButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /><TextView android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Block TV Channels" android:textAppearance="?android:attr/textAppearanceMedium" /><ToggleButton android:id="@+id/toggleButton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /><TextView android:id="@+id/textView9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Banned Music / Videos" android:textAppearance="?android:attr/textAppearanceMedium" /><ToggleButton android:id="@+id/toggleButton5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /><TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Volume Limiter" android:textAppearance="?android:attr/textAppearanceMedium" /><SeekBar android:id="@+id/seekBar2" android:layout_width="match_parent" android:layout_height="wrap_content" /><LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="left" android:textColor="#ffffff" android:text="Max" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="right" android:textColor="#ffffff" android:text="Min" /></LinearLayout><Button android:id="@+id/button1" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Laundry Loads" /><Button android:id="@+id/button2" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Oven Time/Temp" /><Button android:id="@+id/button3" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Home Phone Time/Area" /><Button android:id="@+id/button4" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Printer Sheets/Color" /><TextView android:id="@+id/textView10" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Home Temperature" android:textAppearance="?android:attr/textAppearanceMedium" /><SeekBar android:id="@+id/seekBar3" android:layout_width="match_parent" android:layout_height="wrap_content" /><LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="left" android:textColor="#ffffff" android:text="Max" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="right" android:textColor="#ffffff" android:text="Min" /></LinearLayout> <Button android:id="@+id/saveBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:layout_gravity="center_horizontal" android:text="@string/save_btn"/></LinearLayout></ScrollView>\[/code\]WORKING XML (Before Adding Form Widgets)\[code\]<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"><LinearLayout android:id="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="5dp"> <EditText android:id="@+id/nameEdit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:imeOptions="actionNext" android:hint="@string/name_hint" android:inputType="textPersonName|textCapWords"/> <EditText android:id="@+id/capEdit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:imeOptions="actionNext" android:hint="@string/cap_hint" android:inputType="textPersonName|textCapWords"/><TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Data Limit" android:textColor="#ffffff" android:textAppearance="?android:textAppearanceMedium" /><SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_height="wrap_content" /><LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="left" android:textColor="#ffffff" android:text="Unlimited" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="right" android:textColor="#ffffff" android:text="10MB" /></LinearLayout><TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Bandwidth Limit" android:textColor="#ffffff" android:textAppearance="?android:textAppearanceMedium" /><SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_height="wrap_content" /><LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:gravity="left" android:textColor="#ffffff" android:text="Unlimited" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1.0" android:textColor="#ffffff" android:gravity="right" android:text="10kbs" /></LinearLayout><TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:textAppearanceSmall" /><TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="WiFi Time Limit" android:textColor="#ffffff" android:textAppearance="?android:textAppearanceMedium" /><TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:layout_weight="1.0" /><EditText android:id="@+id/codeEdit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:ems="10" android:hint="@string/code_hint" android:imeOptions="actionNext"> <requestFocus /></EditText> <Button android:id="@+id/saveBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:layout_gravity="center_horizontal" android:text="@string/save_btn"/></LinearLayout></ScrollView>\[/code\]NewCore.Java (same for both files)\[code\]import android.os.AsyncTask;import android.os.Bundle;import android.app.ListActivity;import android.content.Intent;import android.database.Cursor;import android.view.Menu; import android.view.MenuInflater;import android.view.MenuItem;import android.view.View;import android.widget.AdapterView;import android.widget.CursorAdapter;import android.widget.ListView;import android.widget.SimpleCursorAdapter;import android.widget.AdapterView.OnItemClickListener;public class NewCore extends ListActivity { public static final String ROW_ID = "row_id"; private ListView conListView; private CursorAdapter conAdapter;@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); conListView=getListView(); conListView.setOnItemClickListener(viewConListener); // map each name to a TextView String[] from = new String[] { "name" }; int[] to = new int[] { R.id.countryTextView }; conAdapter = new SimpleCursorAdapter(NewCore.this, R.layout.country_list, null, from, to); setListAdapter(conAdapter); // set adapter}@Overrideprotected void onResume() { super.onResume(); new GetContacts().execute((Object[]) null); } @Overrideprotected void onStop() { Cursor cursor = conAdapter.getCursor(); if (cursor != null) cursor.deactivate(); conAdapter.changeCursor(null); super.onStop();} private class GetContacts extends AsyncTask<Object, Object, Cursor> { DatabaseConnector dbConnector = new DatabaseConnector(NewCore.this); @Override protected Cursor doInBackground(Object... params) { dbConnector.open(); return dbConnector.getAllContacts(); } @Override protected void onPostExecute(Cursor result) { conAdapter.changeCursor(result); // set the adapter's Cursor dbConnector.close(); } } @Overridepublic boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.country_menu, menu); return true;} @Overridepublic boolean onOptionsItemSelected(MenuItem item) { Intent addContact = new Intent(NewCore.this, AddEditCountry.class); startActivity(addContact); return super.onOptionsItemSelected(item);}OnItemClickListener viewConListener = new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { Intent viewCon = new Intent(NewCore.this, ViewCountry.class); viewCon.putExtra(ROW_ID, arg3); startActivity(viewCon); }}; \[/code\]}
 
Back
Top