I want it so that when I click a button the text will become visible.
I failed.
Please, help me
Loveandriod.java
package com.example.farjad.andriodlove;
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.TextView;
public class LoveAndriod extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_love_andriod);
}
public void onLoveButtonClicked(View view){
TextView.setVisibility(R.id.haikowtext);
TextView haikotext=findViewById(View.VISIBLE);
}
#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_love_andriod, 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);
}
}
and the activity log is below;
activity.love_andriod.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=".LoveAndriod">
<TextView android:text="#string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/haikowtext"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="123dp"
android:visibility="invisible" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/love_button_text"
android:id="#+id/button"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:onClick="onLoveButtonClicked"/>
</RelativeLayout>
How can I sove that?
I am a beginner with Android Studio.
Try this:
TextView haikotext = (TextView)findViewById(R.id.haikowtext);
haikotext.setVisibility(View.VISIBLE);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_love_andriod);
TextView tv = (TextView)findViewById(R.id.haikowtext);
}
public void onLoveButtonClicked(View view){
tv.setVisibility(View.VISIBLE);
}
Related
I'm getting a "cannot resolve symbol variable" on maleButton, on the bottom where the femaleSelected is. I've defined the RadioButtons in onCreate(). I thought onCreate() was protected, and that's why I couldn't access the buttons. But changing it into public solves nothing.
Here's the relevant code:
package ideaman924.playground;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RadioButton;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RadioButton maleButton,femaleButton;
maleButton = (RadioButton) findViewById(R.id.male);
femaleButton = (RadioButton) findViewById(R.id.female);
}
#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);
}
public void femaleSelected(View view) {
maleButton.toggle(); // error
}
}
Any idea why this is happening?
EDIT: Here is also the XML layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Select gender" />
<RadioButton
android:id="#+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="female"
android:onClick="femaleSelected" />
<RadioButton
android:id="#+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="male"
android:onClick="maleSelected" />
</LinearLayout>
Your RadioButton malebutton is a local variable and it is visible only in that method.
If you want to see it at the class level, you should move
RadioButton malebutton,femalebutton;
after
public class MainActivity extends AppCompatActivity {
Read about variables.
you need to define RadioButton malebutton out of onCreate method global variable for your class.
RadioButton malebutton,femalebutton;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//RadioButton maleButton,femaleButton;
maleButton = (RadioButton) findViewById(R.id.male);
femaleButton = (RadioButton) findViewById(R.id.female);
}
I have tried searching for answers but i haven't found the fix for my problem yet. I have 2 activities -apple and Bacon. I am trying to learn intents and data passing between activities. The apple activity is supposed to pass the value entered in the EditText field on a button click to the bacon activity which just displays the value.
I am getting the following exception on the stack
Caused by: java.lang.NullPointerException: Attempt to invoke
virtual method 'android.text.Editable android.widget.EditText.getText()'
on a null object reference
The code snippets are as follows:-
apples.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=".Apple"
android:background="#009900">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Apples"
android:id="#+id/applesText"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Go to Bacon"
android:id="#+id/applesButton"
android:layout_below="#+id/applesText"
android:layout_centerHorizontal="true"
android:layout_marginTop="104dp"
android:onClick="onClickApples"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/personName"
android:layout_below="#+id/applesText"
android:layout_centerHorizontal="true" />
Apples.java
package com.example.karan.intentexample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.content.Intent;
import android.widget.EditText;
public class Apple extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apple);
}
#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_apple, 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);
}
public void onClickApples(View view){
final EditText applesInput = (EditText)view.findViewById(R.id.personName);
String userMessage = applesInput.getText().toString();
Intent i = new Intent(this, Bacon.class);
//putExtra takes data in the form of a key-value pair
i.putExtra("appleMessage", userMessage);
startActivity(i);
}
}
Bacon.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="com.example.karan.intentexample.Bacon"
android:background="#72231F">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Bacon"
android:id="#+id/baconText"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/baconButton"
android:layout_below="#+id/baconText"
android:layout_centerHorizontal="true"
android:layout_marginTop="99dp" />
Bacon.java
package com.example.karan.intentexample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class Bacon extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bacon);
Bundle applesData;
applesData = getIntent().getExtras();
//if there is no data in the intent
if(applesData==null)
return;
//get value by using the key in the getString method
String appleMessage = applesData.getString("appleMessage");
final TextView baconText = (TextView)findViewById(R.id.baconText);
baconText.setText(appleMessage);
}
#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_bacon, 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);
}
}
Here:
final EditText applesInput = (EditText)view.findViewById(R.id.personName);
view.findViewById causing issue.change it to:
final EditText applesInput = (EditText)Apple.this.findViewById(R.id.personName);
Because EditText with personName id is in Activity layout instead of inside Button layout(view parameter of onClickApples)
public class Apple extends AppCompatActivity {
private EditText applesInput;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apple);
applesInput = (EditText)findViewByID(R.id.personName);
}
public void onClickApples(View view){
String userMessage = applesInput.getText().toString();
Intent i = new Intent(this, Bacon.class);
//putExtra takes data in the form of a key-value pair
i.putExtra("appleMessage", userMessage);
startActivity(i);
}
}
Indefinite.java
This is my main code and there is someproblem with the code.Any help will very appreciated.
package mycompanycom.indefinite;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
public class Indefinite extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_indefinite);
}
#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_indefinite, 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,DisplayMessageActivity.class);
startActivity(intent);
}
}
This is my xml for my first project.
activity_indefinite.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="wrap_content"
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=".Indefinite">
<Button
android:id="#+id/the_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/INDEFINITE"
android:onClick="onClick"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#55ff0000"
android:src="#drawable/images"
android:layout_below="#+id/the_button"
android:layout_centerHorizontal="true"
android:layout_marginTop="85dp" />
</RelativeLayout>
This is my second activity code programmatically written
DisplayMessageActivity.java
package mycompanycom.indefinite;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
public class DisplayMessageActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
}
#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);
}
}
In my second activity I have written getIntent() to accept the intent.
public void onClick(View view) is part of the View.OnClickListener interface. To make your app compile you have to add implements View.OnClickListener to the definition of your class
You don't need #override here, because you already mentioned the method name in XML file itself, remove it(#override) before onClick() method and run.
I am trying to change the text in one of the textview by calling it in a function that is assigned to a button.. However it is not quite working as I hoped. I was wondering if some one could point out why isn't it working?
Here is the "MainActivity.java" file
package com.nblsoft.myapplication;
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.TextView;
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#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);
}
String stri = new String("Hellow");
public void game(View view) {
TextView textv = (TextView) findViewById(R.id.textView2);
textv.setText(stri);
}
}
and the "activity_main.xml" file
<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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Welcome"
android:id="#+id/textView"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/lower_text"
android:id="#+id/textView2"
android:layout_below="#+id/editText"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:inputType="number"
android:text="#string/guess"
android:textSize="160dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:onClick="game"/>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok"
android:id="#+id/button"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
you want call game when click in EditText?! you put android:onClick="game" in EditText
if want call when click in Button you must add android:onClick="game" to your Button in activity_main.xml file like
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok"
android:id="#+id/button"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:onClick="game" />
or you can use this in MainActivity.java instead use android:onClick="game" in xml file
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button=(Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
game(arg0);
}
});
}
- remove android:onClick="game" from EditText
package com.nblsoft.myapplication;
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.TextView;
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textv = (TextView) findViewById(R.id.textView2);
String stri = new String("Hellow");
Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
textv.setText(stri);
}
});
}
#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);
}
}
This should be working.By the way.Don't rush into android like this...you've got to learn a few things about how it works before you can play with it.Try to check the documentation and play with all that android offers.It's actually fun.It was for me and it still is as I've got to learn a lot ,still.
you call the method game() when you click the edittext "editText", and this will change the textview. If you want to change the value of the textview by clicking button "button", i think you just need to move the game() method to the Button field:
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ok"
android:id="#+id/button"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:onClick="game" />
i am using to learn zoomcontrols. i am now at the begining android.
when closer if i, It does not seem a part of the picture. codes below. please help me
i dont want pinc zoom.. i want simply button zoom. and i am sorry for my English :( i hope you are understand me..
xml
<LinearLayout 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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/resim"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<ZoomControls
android:id="#+id/zoomControls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
</LinearLayout>
and java
package com.example.kusem.ikiliscrollldenemeleri;
import android.annotation.TargetApi;
import android.os.Build;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.Layout;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.ZoomControls;
public class MainActivity extends ActionBarActivity {
ImageView iv;
ZoomControls zoom;
ScrollView sv;
HorizontalScrollView hsv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
zoom= (ZoomControls) findViewById(R.id.zoomControls);
iv= (ImageView) findViewById(R.id.resim);
// hsv= (HorizontalScrollView) findViewById(R.id.hsv);
iv.setImageResource(R.drawable.resim2);
zoom.setOnZoomInClickListener(new View.OnClickListener() {
#TargetApi(Build.VERSION_CODES.HONEYCOMB)
#Override
public void onClick(View v) {
float x = iv.getScaleX();
float y = iv.getScaleY();
iv.setScaleX((float)(x+1));
iv.setScaleY((float)(y+1));
}
});
zoom.setOnZoomOutClickListener(new View.OnClickListener() {
#TargetApi(Build.VERSION_CODES.HONEYCOMB)
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
float x = iv.getScaleX();
float y = iv.getScaleY();
iv.setScaleX((float) (x-1));
iv.setScaleY((float) (y-1));
}
});
}
#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);
}
}
Thank you in advance for your help..