Can't Get Focus on Button in FragmentActivity - android

After spending enough time unsuccessfully, I am posting it here to seek help. I have a ListFragment called from the following FragmentActivity. In the Layout there is a Submit button on top, so that user can scroll the list and press the Submit button when done with filling in the information. However I can't click this submit button. It never gets focus. How can I fix it?
Thanks for your help.
I have this FragmentActivity:
public class SurveyFragmentAnchor extends FragmentActivity {
Button submit;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_survey_fragment);
setTitle("Feedback and Survey");
submit = (Button) findViewById(R.id.submit_button);
submit.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Log.v("SURVEY", "Button pressed");
}
});
}
}
And here is the Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="4dp" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#e5e5e5">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#ee000000" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:paddingBottom="10dp"
android:text="Rating (1-5) 5= Excellent, 4=Very good, 3=Good,\n2= Satisfactory, 1= Needs Improvement"
android:textColor="#FFF" />
<Button
android:background="#drawable/button_blue2"
android:textColor="#FFF"
android:id="#+id/submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/my_survey_fragment"
android:text="Submit" />
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:drawSelectorOnTop="false" >
</ListView>
</LinearLayout>
<fragment
android:name="com.survey.MySurvey"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="47dp"
android:id="#+id/my_survey_fragment">
</fragment>

Try using these fields on the button:
android:focusable="true"
android:focusableInTouchMode="true"

Related

How to shift a LinearLayout when a SlidingDrawer expands?

I am trying to implement a panel in a fragment that can expand on button click from the right side of the screen. I can't use the navigation drawer, because I already have navigation drawers from both left and right sides.
The idea is to achieve something like that:
I was almost able to do it with the SlidingDrawer widget (it's deprecated..), the only problem is that I don't know how to make the LinearLayout to appear in the middle and then to shift when the button to expand the SlidingDrawer is clicked.
I have the following code:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button handle = (Button) findViewById(R.id.handle);
SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.slidingDrawer);
drawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
#Override
public void onDrawerOpened() {
}
});
drawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
#Override
public void onDrawerClosed() {
}
});
}
}
And the XML 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"
tools:context="com.test.slidingdrawertest.slidingdrawertest.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TEST TEST" />
</LinearLayout>
<LinearLayout
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<SlidingDrawer
android:id="#+id/slidingDrawer"
android:layout_width="200dp"
android:layout_height="400dp"
android:layout_marginTop="100dp"
android:layout_gravity="end"
android:content="#+id/content"
android:handle="#+id/handle"
android:orientation="horizontal">
<Button
android:id="#+id/handle"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Expand" />
<LinearLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TEST TEST" />
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
</RelativeLayout>
You can edit your XML like this
?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:padding="10dp"
tools:context="com.test.slidingdrawertest.slidingdrawertest.MainActivity">
<LinearLayout
android:id="#+id/left" // this is your linear layout
android:layout_width="match_parent" // that you want to shift left
android:layout_height="match_parent"
android:layout_toLeftOf="#+id/right" // apply this property due to
android:layout_alignParentLeft="true" //which if the width of sliding menu
android:gravity="center" //increase it will automatically compressed
android:background="#aa00aa"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TEST TEST" />
</LinearLayout>
<LinearLayout
android:id="#+id/right"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:background="#0000aa"
android:layout_height="match_parent">
<SlidingDrawer
android:id="#+id/slidingDrawer"
android:layout_width="200dp" // you can check by increasing or decreasing the with of this slidingdrawer
android:layout_height="400dp"
android:layout_marginTop="100dp"
android:layout_gravity="end"
android:content="#+id/content"
android:handle="#+id/handle"
android:orientation="horizontal">
<Button
android:id="#+id/handle"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Expand" />
<LinearLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TEST TEST" />
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
</RelativeLayout>
apart from this if set any layout to the right of your linear layout which is initially GONE and as you click on the button its visibility changed to INVISIBLE/VISIBLE so it will shift the linear layout to left. Hope that helps!
If you want a little exemple here is my solution: (I don't know if Avani Nagar's solution works or not):
TextView res;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView img = (TextView)findViewById(R.id.second);
res = (TextView)findViewById(R.id.first);
img.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
img.setX(img.getX() - 5);
changew(img.getX());
}
});
}
private void changew(float w){
res.getLayoutParams().width = (int)(res.getX() +w);
res.requestLayout();
res.invalidate();
}
The xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/black">
<TextView
android:layout_toRightOf="#+id/first"
android:text="bonjourrrrrr"
android:id="#+id/second"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#android:color/holo_red_dark" />
<TextView
android:text="salutttttttt"
android:id="#id/first"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:background="#android:color/holo_green_light" />
</RelativeLayout>
I managed to do it, it actually wasn't so difficult, but it's a little tricky. Here is the solution:
The xml 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:id="#+id/topLayout"
tools:context="com.test.slidingdrawertest.slidingdrawertest.MainActivity">
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST" />
</LinearLayout>
<LinearLayout
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<SlidingDrawer
android:id="#+id/slidingDrawer"
android:layout_width="200dp"
android:layout_height="400dp"
android:layout_marginTop="100dp"
android:layout_gravity="end"
android:content="#+id/content"
android:handle="#+id/handle"
android:orientation="horizontal">
<Button
android:id="#+id/handle"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Expand" />
<LinearLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST TEST TESTT" />
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
</RelativeLayout>
The code in MainActivity.java:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button handle = (Button) findViewById(R.id.handle);
SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.slidingDrawer);
final View k = findViewById(R.id.mainLayout);
drawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
#Override
public void onDrawerOpened() {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
k.setLayoutParams(params);
}
});
drawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
#Override
public void onDrawerClosed() {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
k.setLayoutParams(params);
}
});
}
}
And the explanation: I had to give main main layout an id (in XML) and then find it in the code behind, then I had to apply new parameters to it when the drawer opens or closes. Basically, we need to find the parent layout and set the parameters to it.
Now the LinearLayout is able to shift it's position on drawer open, and it goes back to it's original position on drawer close. Next step is to make this process with an animation, so it's smooth and doesn't just jump back and forth to the new positions.

couldnt save which view has focus?

my app contains "Settings" activity which contains 2 imagebuttons "back" and "about", whenever i press any of these buttons i get:
"couldnt save which view has focus because the focused view android.widget.LinearLayout#4055a9e0 has no id"
the xml code for my_settings:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ll2"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="15" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_margin="8dp"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/settings" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|end"
android:orientation="horizontal" >
<ToggleButton
android:id="#+id/tb1"
android:layout_margin="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="#string/sett1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/border2"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/ll_set_back"
android:layout_margin="3dp"
android:gravity="center"
android:layout_weight="1"
android:orientation="vertical" >
**<ImageButton
android:id="#+id/st_ibt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/action_btn"
android:src="#drawable/back_ic" />**
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/back"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/ll_set_about"
android:layout_margin="3dp"
android:gravity="center"
android:layout_weight="1"
android:orientation="vertical" >
**<ImageButton
android:id="#+id/st_ibt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/action_btn"
android:src="#drawable/about_ic" />**
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/about"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
dont pay attention to the "scrollview" (i dont think the problem is there), just look at the end of the code for the 2 imagebuttons..
and this the java code for Settings:
public class Settings extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.my_settings);
//code...
ImageButton goBack=(ImageButton)findViewById(R.id.st_ibt1);
ImageButton about=(ImageButton)findViewById(R.id.st_ibt2);
goBack.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View v)
{
Intent intent=new Intent(Settings.this, MainActivity.class);
startActivity(intent);
//finish();
}
});
about.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View v)
{
Intent intent=new Intent(Settings.this, About.class);
startActivity(intent);
//finish();
}
});
}
so, how to fix this? i dont understand what this error means.. any suggestions
I think the problem is :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical" >
You enable focus to this LinearLayout, but you didn't provide any id for it.

ImageView onClick is not working FragmentActivity

May be it is so easy but do not know i have tried so much but it's not working :(
I have layout like this way
And i have following java code
public class MainActivity extends FragmentActivity{
private ImageView ivMainMenu;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ivMainMenu = (ImageView) findViewById(R.id.ivMainMenu);
ivMainMenu.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
System.out.println("showSlider clicked");
}
});
}
i have tried
android:clickable="true"
but still not working
below is my xml code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/rlMainHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_bg"
android:orientation="vertical" >
<TextView
android:id="#+id/tvHeaderText"
style="#style/header_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<TextView
android:id="#+id/txtScore"
style="#style/black_large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="#dimen/extra_small"
android:background="#drawable/keyboard_btn"
android:padding="#dimen/extra_small"
android:text="#string/finish"
android:textColor="#color/dark_text_color"
android:textStyle="bold"
android:visibility="gone" />
<ImageView
android:id="#+id/ivMainMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:clickable="true"
android:src="#drawable/menu" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/rlMainHeader"
android:background="#color/main_bg"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/flMain"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<LinearLayout
android:id="#+id/llMainSlider"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="visible" >
<include
android:layout_width="wrap_content"
android:layout_height="match_parent"
layout="#layout/slider" />
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/dark_text_color"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>
in my logcat i am getting following message whenever i click on imageview
04-27 11:09:42.996: V/Provider/Settings(1018): from settings cache , name = sound_effects_enabled , value = 0
also i want to let you know that if i load any fragment in flMain, in that fragment all event is working fine but not on main layout :( also in llMainSlider noting was happening :(
Why don't you try declaring the event on the XML?
It is as simple as this
android:id="#+id/ivMainMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:onClick="myNewMethod" <!--add this extra line!--->
android:src="#drawable/menu" />
and simply on your Main activity add the myNewMethod as am extra function like this
public class MainActivity extends FragmentActivity{
private ImageView ivMainMenu;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void myNewMethod(View v) {
System.out.println("showSlider clicked");
}
Good Luck ;)

remove the textview and button from an activity and pull remaining components up after clicking a button

I have an activity which loads in a linear layout from XML file.
What I want is that an additional textview and a button should appear when the application is run. BUT it should never appear again when the user clicks on "bGotIt" button [using the sharedpreferences stuff]
But what I want is that the textview and button must appear at the top of the activity and must push down my permanent components !! And when the "bGotIt" button is clicked, both these textview and button should disappear and the permanent components must pull themselves up and fill the screen.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="#+id/done"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="#+id/firstTimeText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Bla bla bla bla "
/>
<Button
android:id="#+id/bGotIt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Got it !! "
android:visibility="gone"
/>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
Here I have my permanent components
</RelativeLayout>
</FrameLayout>
</LinearLayout>
// try this way, hope this will help you...
Note : i try to put this "Button" and "TextView" in one layout and just try to change layout visibility (Show/Hide) on "bGotIt" "Button" click.
**activity_main**
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/lnrHidable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="#+id/done"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/firstTimeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Bla bla bla bla "/>
</LinearLayout>
<Button
android:id="#+id/bGotIt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Got it !! "
android:visibility="gone"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
Here I have my permanent components
</RelativeLayout>
</FrameLayout>
</LinearLayout>
**MyActivity**
public class MyActivity extends Activity{
private LinearLayout lnrHidable;
private Button bGotIt;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lnrHidable = (LinearLayout) findViewById(R.id.lnrHidable);
bGotIt = (Button) findViewById(R.id.bGotIt);
// visiable as your sharedpreferences
bGotIt.setVisibility(View.VISIBLE);
bGotIt = (Button) findViewById(R.id.bGotIt);
bGotIt.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
lnrHidable.setVisibility(View.GONE);
}
});
}
}

Android :: getViewById in another Activity (not super.onCreate())

I have created an activity and now I am trying to add an eventListener to a button:
But when I switch to the AddEntryActivity I get an SuperNotCalledException().
Any help is really appreciated!
public class AddEntryActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_entry);
ImageButton test = (ImageButton) findViewById(R.id.mg_add_entry_button_save);
...
Here is my activity_add_entry.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment"
android:background="#drawable/radialback">
<LinearLayout
android:orientation="vertical"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:id="#+id/mg_overview"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_above="#+id/mg_menu_bar">
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:inputType="numberDecimal">
</EditText>
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:inputType="date"/>
<Spinner
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/mg_add_entry_spinner_categories"
android:entries="#array/basic_categories_array"
android:prompt="#string/abc_activity_chooser_view_see_all"></Spinner>
<Button
android:id="#+id/mg_add_entry_button_save"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="#string/mg_save"/>
</LinearLayout>
<LinearLayout
android:id="#+id/mg_menu_bar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<ImageButton
android:id="#+id/mg_menu_button_add_entry"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="#drawable/abc_ic_go"/>
</LinearLayout>
</RelativeLayout>
Hard to say without seeing your logcat, but chances are that you're overriding some method in the previous activity class (such as onPause or onStop), and you're missing the call to super.-
#Override
public void onPause() {
super.onPause();
// Your stuff
}

Categories

Resources