When using setOnClickFillInIntent and setPendingIntentTemplate, click events never occur - android

I am working on an Android home screen app widget that fills a listview with custom defined row layouts.
The listview gets populated correctly, but when I click any of the items, nothing happens.
Here is some of the relevant parts
From the AppWidgetManager's onUpdate()
...
final Intent contactIntent = new Intent(context, ContactService.class);
contactIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
contactIntent.setData(Uri.parse(contactIntent.toUri(Intent.URI_INTENT_SCHEME)));
view.setRemoteAdapter(widgetId, R.id.listview, contactIntent);
//works fine up to here, populates ListView
//Set up pendingIntentTemplate
final Intent contactClick = new Intent(context,ContactDial.class);
contactClick.setData(Uri.parse(contactClick.toUri(Intent.URI_INTENT_SCHEME)));
final PendingIntent contactClickPI = PendingIntent.getBroadcast(context,
0,contactClick,PendingIntent.FLAG_UPDATE_CURRENT);
view.setPendingIntentTemplate(R.id.listview, contactClickPI);
Log.d("TEMPLATE", "set template");
...
From the RemoteViewsFactory's getViewAt(int position)
final Intent i = new Intent();
final Bundle extra = new Bundle();
extra.putString("number", phoneNumber);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtras(extra);
row.setOnClickFillInIntent(R.id.contact_row,i);
Log.d("FACTORY", "Set Intent Template");
The logs show that the code was executed correctly, but for some reason it doesn't seem to register my clicks. I put a Log.d in the onCreate of the class that the intent is supposed to be sent to, but it never happens.
Here are the important parts of my layouts.
The main layout:
<LinearLayout
android:id="#+id/layout_two"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants" >
<ListView
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="260dp" />
<!-- Some other views -->
</LinearLayout>
The custom defined row:
<LinearLayout android:id="#+id/contact_row"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:background="#xml/buttoncolor_selector"
android:paddingBottom="2dp"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingLeft="10dip" >
<ImageView
android:id="#+id/contact_photo"
android:layout_width="#android:dimen/notification_large_icon_width"
android:layout_height="match_parent"
android:layout_marginRight="5dip"
android:src="#drawable/ic_action_person />
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView
android:id="#+id/contact_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textSize="18sp"
android:gravity="center_vertical"
android:singleLine="true"
android:ellipsize="marquee"
android:textIsSelectable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:clickable="false"/>
<TextView
android:id="#+id/contact_number"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"
android:textIsSelectable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:clickable="false" />
</LinearLayout>
</LinearLayout>
I've looked at just at just about every example I can find on the Internet, but none of the solutions have changed anything.
Please help.

In your custom defined row, try moving android:id="#+id/contact_row" down to a child view (even if it's a "useless" viewgroup that just surrounds everything else). Or, surround your top level LinearLayout with a FrameLayout. I didn't have luck having the setOnClickFillInIntent() set to target the ID on the very top level viewgroup like that.
Like so,
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout android:id="#+id/contact_row"
android:orientation="horizontal"
android:layout_width="match_parent"
android:background="#xml/buttoncolor_selector"
android:paddingBottom="2dp"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingLeft="10dip" >
<ImageView
android:id="#+id/contact_photo"
android:layout_width="#android:dimen/notification_large_icon_width"
android:layout_height="match_parent"
android:layout_marginRight="5dip"
android:src="#drawable/ic_action_person" />
........
Depending on your needs, you may be able to eat your cake and have it too, and have a non-useless viewgroup if you rearrange your layout.

Related

LinearLayout not getting clicked

I tried a lot but, my Linearlayout as below not getting clicked :
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/ll_top_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="false"
android:orientation="vertical">
<LinearLayout
android:focusableInTouchMode="true"
android:clickable="true"
android:id="#+id/ll_Promos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/vv_divider4"
android:layout_marginTop="#dimen/dimen_5"
android:orientation="horizontal"
android:padding="#dimen/dimen_10">
<ImageView
android:id="#+id/iv_restaurant_promo"
android:layout_width="#dimen/dimen_25"
android:layout_height="#dimen/dimen_25"
android:layout_gravity="center_vertical"
android:layout_marginLeft="#dimen/dimen_5"
android:layout_marginRight="#dimen/dimen_5"
android:src="#drawable/promos" />
<com.app.thelist.view.CustomTextView
android:id="#+id/txt_restaurant_promo"
style="#style/RegularFont"
android:layout_gravity="center"
android:layout_marginRight="#dimen/dimen_5"
android:layout_weight="1"
android:padding="#dimen/dimen_5"
android:text="#string/promo"
android:textColor="#color/txt_sub_title"
android:textSize="#dimen/sp_15" />
<ImageView
android:id="#+id/iv_restaurant_promo_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="#dimen/dimen_5"
android:src="#mipmap/app_icon"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</ScrollView>
The above is my xml file, and I have make my LinearLayout named : ll_Promos not getting clicked. I have implemented my onClick() as below in java file :
ll_promos = (LinearLayout) findViewById(R.id.ll_Promos);
ll_promos.setOnClickListener(this);
case R.id.ll_Promos:
Intent intentProm = new Intent(Activity1.this, Activity2.class);
startActivity(intentProm);
break;
Remove
android:focusableInTouchMode="false" // Problem starts from here
Set whether this view can receive focus while in touch mode. Setting
this to true will also ensure that this view is focusable.
And Add
android:focusableInTouchMode="true"
android:clickable="true"

Retrieving Id's from nested layouts

My problem is this, I have multiple RelativeLayouts in a LinearLayout inside of a ScrollView that is in the main RelativeLayout. When trying to obtain the id's in the fragment class I have it keeps giving me errors.
I've looked around for an answer for this for about 2 days now and have only come across an idea of using
<include name="some_name" layout="#layout/some_layout"/>
and it doesn't really help me with my app. I'm trying to develop a calendar week view which I already have the numbers working and the time on the left.
Here is my xml file:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/day_labels_linear_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<!-- not important but this holds the numbers up top -->
</LinearLayout>
<ScrollView
android:id="#+id/calendar_scroll_view"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_below="#+id/day_labels_linear_layout"
android:fadingEdge="none"
android:overScrollMode="never"
android:scrollbars = "none">
<!-- used to space each day with the day_labels_linear_layout weights -->
<LinearLayout
android:id="#+id/calendar_spacer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--This has all of the hours, I just didn't include them
because it would take up so much room-->
<RelativeLayout
android:id="#+id/hours_relative_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:background="#color/scheduler_background" >
<TextView
android:id="#+id/time_12_am"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:paddingBottom="25dp"
android:paddingTop="25dp"
android:text="#string/text_time_12_am" />
<TextView
android:id="#+id/time_1_am"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/time_12_am"
android:layout_centerHorizontal="true"
android:paddingBottom="25dp"
android:paddingTop="25dp"
android:text="#string/text_time_1_am" />
<TextView
android:id="#+id/time_2_am"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/time_1_am"
android:layout_centerHorizontal="true"
android:paddingBottom="25dp"
android:paddingTop="25dp"
android:text="#string/text_time_2_am" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/sunday_relative_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" >
<View
android:id="#+id/divider_sunday_left"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="#color/divider_scheduler" />
<Button
android:id="#+id/sunday_day"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="#color/transparent" />
<View
android:id="#+id/divider_sunday_right"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="#color/divider_scheduler" />
</RelativeLayout>
<!-- there is a Relative layout for each day-->
</LinearLayout>
</ScrollView>
</RelativeLayout>
So when I try to access the id's this is what I get:
RelativeLayout sundayRL;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState){
View view = inflater.inflate(R.layout.fragment_scheduler, null);
sundayRL = (RelativeLayout) view.findViewById(R.id.sunday_relative_layout);
}
It gives me the error: sunday_relative_layout cannot be resolved or is not a field, I added a button to see if I could get the id for that and the same result happened. Yet I was able to find the id's for each of the day numbers and day names that is in the top LinearLayout.
Does anyone have a better solution to this? I'm trying to register when the user clicks the view so I can send them to a scheduling page.
EDIT:
So changing null to container allowed me to find my Ids
View view = inflater.inflate(R.layout.fragment_scheduler, container);
But it caused another issue with a map fragment on one of the other fragments saying I didn't have the right API key which it does.
If you have nested layouts
eg:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout >
<RelativeLayout
android:id="#+id/rl2>
<Button
android:id="#+id/getStarted"
/>
</RelativeLayout>
</RelativeLayout>
And you want to press a button in the nested one.
Add ID on the nested Layout.
and use this code in onCreate()
View view = (View) findViewById(R.id.rl2);
Button button = (Button) view.findViewById(R.id.getStarted);

Android - Custom Keyboard on manually inflated listview row not showing

Good day.
I have an android application. In my application, I have a custom listView with 5 columns that are textViews. The user can click the rows, once he does, the row layout will change, changing the last 2 textViews to EditTexts. I then register the new EditTexts onto my custom keyboard taken from this example - kindly note that I did a functional copy-paste of his example with regards to the custom keyboard class and how to make it work in the main layout. However, when I click the EditText in the row, my custom keyboard does not show up at all.
I have a global variable as such:
CustomKeyboard mCustomKeyboard;
And in my onCreate() method in the activity, I do:
mCustomKeyboard= new CustomKeyboard(this, R.id.keyboardview, R.xml.custom_keyboard);
This is my layout, I have the KeyboardView at the bottom of the Layout:
<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:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".SearchResult" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- A lot of views go here, enclosed in my linear layout -->
</LinearLayout>
<android.inputmethodservice.KeyboardView
android:id="#+id/keyboardview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone" />
</RelativeLayout>
Here is the code that changes the layout. What I do is that I take the row values from the old layout, get the new layout search_result_inflate, then set the texts of the new layout using the values I got. Kindly note the mCustomKeyboard.registerEditText(R.id.qtyInputSearchResult); line after inflating the layout:
private void changeLayout(final View view){
//get views from old layout
TextView textViewQuantity = (TextView)view.findViewById(R.id.qtyInput);
TextView textViewDiscountReq = (TextView)view.findViewById(R.id.discInput);
TextView textViewName = (TextView)view.findViewById(R.id.dialogItemName);
TextView textViewPrice = (TextView)view.findViewById(R.id.price);
TextView textViewDiscount = (TextView)view.findViewById(R.id.discount);
//store values in strings
String itemName = textViewName.getText().toString();
String itemPrice = textViewPrice.getText().toString();
String itemDiscount = textViewDiscount.getText().toString();
String itemQty = textViewQuantity.getText().toString();
String itemDisc = textViewDiscountReq.getText().toString();
//set the view to gone
textViewQuantity.setVisibility(View.GONE);
textViewDiscountReq.setVisibility(View.GONE);
textViewName.setVisibility(View.GONE);
textViewPrice.setVisibility(View.GONE);
textViewDiscount.setVisibility(View.GONE);
//get the old layout
LinearLayout ll_inflate = (LinearLayout)view.findViewById(R.id.search_result_layout);
//get the inflate/new view
View child = getLayoutInflater().inflate(R.layout.search_result_inflate, null);
//get the views in the new view, populate them
TextView newName = (TextView)child.findViewById(R.id.dialogItemName);
newName.setText(itemName);
TextView newDiscount = (TextView)child.findViewById(R.id.discount);
newDiscount.setText(itemDiscount);
TextView newPrice = (TextView)child.findViewById(R.id.price);
newPrice.setText(itemPrice);
EditText qtyInput = (EditText)child.findViewById(R.id.qtyInputSearchResult);
qtyInput.setText(itemQty);
EditText discInput = (EditText)child.findViewById(R.id.discInputSearchResult);
discInput.setText(itemDisc);
//show new layout
ll_inflate.removeAllViews();
ll_inflate.removeAllViewsInLayout();
ll_inflate.addView(child);
mCustomKeyboard.registerEditText(R.id.qtyInputSearchResult);
}
Here is my search_result_inflate.xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/search_result_inflate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:minHeight="50dp"
android:orientation="horizontal"
android:padding="1dip"
android:weightSum="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal"
android:padding="1dip" >
<TextView
android:id="#+id/dialogItemName"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="0.54"
android:gravity="center"
android:text="Item Name"
android:textSize="23sp" />
<TextView
android:id="#+id/price"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="0.14"
android:gravity="center"
android:text="Price"
android:textSize="23sp" />
<TextView
android:id="#+id/discount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="0.10"
android:gravity="center"
android:text="Discount"
android:textSize="23sp" />
<EditText
android:id="#+id/qtyInputSearchResult"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="0.14"
android:background="#layout/edittext_selector"
android:gravity="center"
android:hint="qtyInput"
android:textColorHighlight="#color/white_opaque"
android:textSize="23sp" >
</EditText>
<EditText
android:id="#+id/discInputSearchResult"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.11"
android:background="#layout/edittext_selector"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:hint="discInput"
android:textColorHighlight="#color/white_opaque"
android:textSize="23sp" />
</LinearLayout>
</LinearLayout>
As you can see, I have 2 editTexts and I registered qtyInputSearchResult to the custom keyboard class. However, the custom keyboard does not show up.
I also tried to use the custom keyboard class on an editText in another activity and it works just fine. Am I missing something here? I'm confused as to why the custom keyboard does not show up properly.
Any help is very much appreciated, thank you.
Got it, I placed the keyboard layout in the search_result_inflate.xml like so:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/search_result_inflate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:minHeight="50dp"
android:orientation="horizontal"
android:padding="1dip"
android:weightSum="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal"
android:padding="1dip" >
<!-- a lot of components here -->
</LinearLayout>
<android.inputmethodservice.KeyboardView
android:id="#+id/keyboardview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone" />
</RelativeLayout>

ANDROID: SQLite with ListViews

-- This is my layout thus far for the input --
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="#+id/etClassName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:hint="#string/className"/>
<EditText
android:id="#+id/etAssignmentName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="#string/assignmentName"/>
<EditText
android:id="#+id/etDueDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_marginBottom="20dp"
android:hint="#string/dueDate" />
<EditText
android:id="#+id/etNotes"
android:layout_width="match_parent"
android:layout_height="194dp"
android:ems="10"
android:inputType="textMultiLine"
android:layout_marginBottom="5dp"
android:hint="#string/notes"/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal">
<Button
android:id="#+id/bAddAssignments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/addAssignment"
android:layout_weight="1" />
<Button
android:id="#+id/bViewAssignments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/viewAssignments"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
-- Clicking the add button brings you to this page which is supposed to list the assignment name that you can click to view your assignment --
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.63" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/bNewAssignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/newAssignment" />
<Button
android:id="#+id/bdeleteAssignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/deleteAssignment" />
</LinearLayout>
</LinearLayout>
My problem is that I don't know how to populate the second layout when my first layout keeps track of the data. How does the second layout know what the user inputted etc in order to populate the listview
I currently have a dbadapter class(with helper class inside), an entry class(creates entry objects), and an assignmentclass(supposed to display listview)
Any Ideas, please?
Pass the data you need in an Intent bundle.
When you set the intent, put the data you need in ther next class as an extra (assuming strings here, but can be other forms):
Intent myIntent = new Intent(YourActivity.this, NewActivity.class);
myIntent.putExtra("Data1", data1var);
myIntent.putExtra("Data2", data2var);
YourActivity.this.startActivity(myIntent);
In the new class:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String value1 = extras.getString("Data1");
String value2 = extras.getString("Data2");
}
//use your passed strings
}
Your description of the problem is rather vague. I can refer you to one of the tutorials Lars Vogella made about how to use SQLLite together with a ListView. They explain everything nice and simple. I am sure that you will find your answer there!
Update:
onClickListener of the Add-button in InputActivity:
Add your user input to the database (with you DatabaseHelper)
List item Start you second activity including the ListView
onCreate of the ListActivity:
Create for example an Array
Let your DatabaseHelper fill the array with the records you want in the database
Create an Adapter giving you filled array with it

Android: How to use Buttons in Preference Screen

I'd like to provide a Button in the PreferenceActivity. The user should be able to set a
time (e.g. via TimePicker), but there's no ButtonPreference or something like that. I don't want to use EditTextPreference.
So do I have to use a default Button in the PreferenceActivity and save the settings for it manually?
Regards,
cody
Create a custom DialogPreference that incorporates a TimePicker widget. No button required. Should be under 100 lines of code.
Here is a sample project showing, among other things, a custom ColorPreference.
Create a different layout including your custom controls and include ListView on top, see the example below
// extra_settings.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"/>
<TextView
android:id="#+id/feedback"
android:text="Feedback"
/>
<Button
android:id="#+id/about"
android:text="About"
/>
</LinearLayout>
Once this done, onCreate method of your class which is extended from PreferenceActivity add following line
setContentView(R.layout.settings_extras); //name of your layout
bind OnClickListener
View.OnClickListener feedbackPageRedirect = new View.OnClickListener()
{
public void onClick(View v)
{
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback ");
startActivity(emailIntent);
}
};
You can put the button in the activity_layout.xml . For example, if "Activity_Setup.java" is your setup activity, "activity_setup.xml" is its layout, and "myprefs.xml" is the file where your preference layout is stored, then
your should put the button in "activity_setup.xml" under the list, most preferable in a TableRow, like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="#+id/llprefs">
<ListView
android:id="#+id/android:list"
android:tag="lvprefs"
android:layout_width="match_parent"
android:layout_height="0.0dp"
android:layout_weight="1" >
</ListView>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
>
<Button
android:id="#+id/btRegister"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="#string/IdonothaveA"
android:onClick="onClick"
/>
<Button
android:id="#+id/btForgot"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="#string/Iforgot"
android:onClick="onClick" />
<!--
<Button
android:id="#+id/btContact"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="#string/Contact"
android:onClick="onClick" />
-->
</TableRow>

Categories

Resources