I add menu's in my application dynamically depending on the values i get from the back-end in the onPrepareOptionsMenu(Menu menu). Now i would want to decide the action that is to be performed for the menu added dynamically (as i do not know the action to be performed beforehand) depending on certain values that came associated with the menu from the back-end. How do i achieve this. Kindly provide me some ideas on this. Thanks in advance.
Look into onCreateOptionsMenu and onPrepareOptionsMenu. Basically you need to overwrite them in your Activity and handle menus there. You can either remove or add menus in these overwridden methods.
Whole procedure is well-documented and described here
If you mean the option menu, then this guide should help you: Changing the Menu.
It shows how you can dynamically add and remove items from the menu right before it is shown to the user using the onPrepareOptionsMenu() method, which passes you the menu. You can then add or remove items from the menu.
You have to play around with onPrepareOptionsMenu and onCreateOptionsMenu. Here is good example how to do that.
I found a way to achieve what i wanted. I put the values associated to the menu as a part of the MenuItems intent. In the onOptionsItemSelected(MenuItem item) i get the intent from the MenuItem retrieve the values from it and perform the action required. The code is as below:
#Override
public boolean onPrepareOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
ApplicationManager.getInstance().resetCounter();
menu.removeGroup(1);
Vector listOfMenuToBeAdded=Service.getInstance().getMenuList();
Enumeration<com.data.Menu> menuEnumeration = listOfMenuToBeAdded.elements();
while (menuEnumeration.hasMoreElements()) {
com.data.Menu levelOptions = (com.pravaa.mobile.dashboard.data.Menu) menuEnumeration
.nextElement();
MenuItem levelMenuItem = menu.add(1, 100, Menu.NONE,
levelOptions.getCaption());
LevelOptionIntent levelOptionIntent = new LevelOptionIntent();
levelOptionIntent.setAppCode(levelOptions.getAppCode());
levelOptionIntent.setDashboardNumber(levelOptions.getNumber());
levelOptionIntent.setUniqueRecordId(levelOptions
.getUniqueRecordId());
levelOptionIntent.setLevelNumber(levelOptions.getLevelNo());
levelMenuItem.setIntent(levelOptionIntent);
}
return true;
}
Once a menu item is clicked on perform the action according to the values set in the intent.
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
case 100:
LevelOptionIntent levelOptionIntent = (LevelOptionIntent) item
.getIntent();
//Perform what you would want to based on the values set in the intent.
if (levelOptionIntent.getAppCode().equals(A)) {
// Start activity A
}elseif (levelOptionIntent.getAppCode().equals(B)) {
// Start activity B
}else if (levelOptionIntent.getAppCode().equals(C)) {
// Start activity C
}
break;
}
return true;
}
The LevelOptionsIntent class is as below:
public class LevelOptionIntent extends Intent {
private int dashboardNumber;
private String appCode;
private String uniqueRecordId;
private int levelNumber;
public LevelOptionIntent() {
super();
// TODO Auto-generated constructor stub
}
public int getDashboardNumber() {
return dashboardNumber;
}
public void setDashboardNumber(int dashboardNumber) {
this.dashboardNumber = dashboardNumber;
}
public String getAppCode() {
return appCode;
}
public void setAppCode(String appCode) {
this.appCode = appCode;
}
public String getUniqueRecordId() {
return uniqueRecordId;
}
public void setUniqueRecordId(String uniqueRecordId) {
this.uniqueRecordId = uniqueRecordId;
}
public int getLevelNumber() {
return levelNumber;
}
public void setLevelNumber(int levelNumber) {
this.levelNumber = levelNumber;
}}
I am not sure if this is the right way of doing it though.Can someone throw some light on this.
Thanks in advance.
Related
I'm trying to change the title of a menu item from outside of the onOptionsItemSelected(MenuItem item) method.
I already do the following;
public boolean onOptionsItemSelected(MenuItem item) {
try {
switch(item.getItemId()) {
case R.id.bedSwitch:
if(item.getTitle().equals("Set to 'In bed'")) {
item.setTitle("Set to 'Out of bed'");
inBed = false;
} else {
item.setTitle("Set to 'In bed'");
inBed = true;
}
break;
}
} catch(Exception e) {
Log.i("Sleep Recorder", e.toString());
}
return true;
}
however I'd like to be able to modify the title of a particular menu item outside of this method.
I would suggest keeping a reference within the activity to the Menu object you receive in onCreateOptionsMenu and then using that to retrieve the MenuItem that requires the change as and when you need it. For example, you could do something along the lines of the following:
public class YourActivity extends Activity {
private Menu menu;
private String inBedMenuTitle = "Set to 'In bed'";
private String outOfBedMenuTitle = "Set to 'Out of bed'";
private boolean inBed = false;
#Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
// Create your menu...
this.menu = menu;
return true;
}
private void updateMenuTitles() {
MenuItem bedMenuItem = menu.findItem(R.id.bedSwitch);
if (inBed) {
bedMenuItem.setTitle(outOfBedMenuTitle);
} else {
bedMenuItem.setTitle(inBedMenuTitle);
}
}
}
Alternatively, you can override onPrepareOptionsMenu to update the menu items each time the menu is displayed.
As JxDarkAngel suggested, calling this from anywhere in your Activity,
invalidateOptionsMenu();
and then overriding:
#Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem item = menu.findItem(R.id.bedSwitch);
if (item.getTitle().equals("Set to 'In bed'")) {
item.setTitle("Set to 'Out of bed'");
inBed = false;
} else {
item.setTitle("Set to 'In bed'");
inBed = true;
}
return super.onPrepareOptionsMenu(menu);
}
is a much better choice. I used the answer from https://stackoverflow.com/a/17496503/568197
you can do this create a global "Menu" object then assign it in onCreateOptionMenu
public class ExampleActivity extends AppCompatActivity
Menu menu;
then assign here
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
this.menu = menu;
return true;
}
Then later use assigned Menu object to get required items
menu.findItem(R.id.bedSwitch).setTitle("Your Text");
Create a setOptionsTitle() method and set a field in your class. Such as:
String bedStatus = "Set to 'Out of Bed'";
...
public void setOptionsTitle(String status)
{
bedStatus = status;
}
Now when the menu gets populated, change the title to whatever your status is:
#Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(bedStatus);
// Return true so that the menu gets displayed.
return true;
}
You better use the override onPrepareOptionsMenu
menu.Clear ();
if (TabActual == TabSelec.Anuncio)
{
menu.Add(10, 11, 0, "Crear anuncio");
menu.Add(10, 12, 1, "Modificar anuncio");
menu.Add(10, 13, 2, "Eliminar anuncio");
menu.Add(10, 14, 3, "Actualizar");
}
if (TabActual == TabSelec.Fotos)
{
menu.Add(20, 21, 0, "Subir foto");
menu.Add(20, 22, 1, "Actualizar");
}
if (TabActual == TabSelec.Comentarios)
{
menu.Add(30, 31, 0, "Actualizar");
}
Here an example
I use this code to costum my bottom navigation item
BottomNavigationView navigation = this.findViewById(R.id.my_bottom_navigation);
Menu menu = navigation.getMenu();
menu.findItem(R.id.nav_wall_see).setTitle("Hello");
Declare your menu field.
private Menu menu;
Following is onCreateOptionsMenu() method
public boolean onCreateOptionsMenu(Menu menu) {
this.menu = menu;
try {
getMenuInflater().inflate(R.menu.menu_main,menu);
} catch (Exception e) {
e.printStackTrace();
Log.i(TAG, "onCreateOptionsMenu: error: "+e.getMessage());
}
return super.onCreateOptionsMenu(menu);
}
Following will be your name setter activity. Either through a button click or through conditional code
public void setMenuName(){
menu.findItem(R.id.menuItemId).setTitle(/*Set your desired menu title here*/);
}
This worked for me.
You can do it like this, and no need to dedicate variable:
Toolbar toolbar = findViewById(R.id.toolbar);
Menu menu = toolbar.getMenu();
MenuItem menuItem = menu.findItem(R.id.some_action);
menuItem.setTitle("New title");
Or a little simplified:
MenuItem menuItem = ((Toolbar)findViewById(R.id.toolbar)).getMenu().findItem(R.id.some_action);
menuItem.setTitle("New title");
It works only - after the menu created.
You can Change Menu Item text using below Code: -
fun showPopup(v: View) {
popup = PopupMenu(context, v)
val inflater = popup?.menuInflater
popup?.setOnMenuItemClickListener(this)
inflater?.inflate(R.menu.menu_main, popup?.menu)
val menu: Menu = popup!!.menu
val item = menu.findItem(R.id.name)
if (item.title.equals("Name")) {
item.title = "Safal Bhatia"
}
}
It seems to me that you want to change the contents of menu inside a local method, and this method is called at any time, whenever an event is occurred, or in the activity UI thread.
Why don't you take the instance of Menu in the global variable in onPrepareOptionsMenu when this is overridden and use in this method of yours. Be sure that this method is called whenever an event is occurred (like button click), or in the activity UI thread, handler or async-task post-execute.
You should know in advance the index of this menu item you want to change. After clearing the menu, you need to inflate the menu XML and update your item's name or icon.
For people that need the title set statically.
This can be done in the AndroidManifest.xml
<activity
android:name=".ActivityName"
android:label="Title Text" >
</activity>
I needed to change the menu icon for the fragment. I altered Charles’s answer to this question a bit for the fragment:
private Menu top_menu;
//...
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
//...
rootview = inflater.inflate(R.layout.first_content,null);
}
#Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.fragment_menu, menu);
this.top_menu = menu;
}
// my procedure
private void updateIconMenu() {
if(top_menu!= null) {
MenuItem nav_undo = top_menu.findItem(R.id.action_undo);
nav_undo.setIcon( R.drawable.back);
}
}
I hit this problem too. In my case I wanted to set the string to
reflect additional information using getString.
As stated above you need to find the correct menuItem in the menu and set it in the onPrepareOptionsMenu method. The solutions above didn't handle the case where the item was in a sub menu and for this you need to search the submenu for the item. I wrote a little Kotlin recursive function to allow me to this for multiple items. Code below...
override fun onPrepareOptionsMenu(menu: Menu) {
...
menu.menuSetText(R.id.add_new_card,
getString(R.string.add_card, currentDeck.deckName))
...
}
private fun Menu.getMenuItem(idx: Int, itemId: Int): MenuItem? {
Log.d(TAG, "getMenuItem: $idx of ${this.size()}")
if (idx >= size()) return null
val item = getItem(idx)
if (item.hasSubMenu()) {
val mi = item.subMenu.getMenuItem(0, itemId)
// mi non-null means we found item.
if (mi != null)
return mi
}
if (item != null && item.itemId == itemId)
return item
return getMenuItem(idx + 1, itemId)
}
fun Menu.menuSetText(itemId: Int, title: String) {
val menuItem = getMenuItem(0, itemId)
if (menuItem != null)
menuItem.title = title
else
Log.e(TAG,
"menuSetText to \"$title\": Failed to find ${
"itemId:0x%08x".format(itemId)}"
)
}
While working with my application, I had to come to come across a situation where I supposed to use menu which has to get displayed in entire application when user click menu button. So I used following code in Default activity but then realized that menu is displaying in that activity but not in all.
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.del_boy_menu, menu);
//below comented code for changung dynamically
// MenuItem bedMenuItem = menu.findItem(R.id.home);
// bedMenuItem.setTitle("title changed");
// System.out.println("onCreate executed");
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
System.out.println("onOptionSelected executed");
switch (item.getItemId()) {
case R.id.home:
// Single menu item is selected do something
// Ex: launching new activity/screen or show alert message
Toast.makeText(MainDeliveryBoyActivity.this, "Home is Selected", Toast.LENGTH_SHORT).show();
// MenuHomeActivity
startActivity(new Intent(context,MenuHomeActivity.class));
return true;
case R.id.delivered1:
Toast.makeText(MainDeliveryBoyActivity.this, "delivered is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.cancelled:
Toast.makeText(MainDeliveryBoyActivity.this, "cancelled is Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.active:
Toast.makeText(MainDeliveryBoyActivity.this, "active is Selected", Toast.LENGTH_SHORT).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
So my question is should I copy and paste all the above code in all the activities? or is there a way where I can skip this?
Create one global activity called BaseActivity and make all of your activities extend it.
public class BaseActivity extends AppCompatActivity{
public void onCreate(Bundle iCreate){
...
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.del_boy_menu, menu);
....
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
....
}
}
And now all other activities should extend the BaseActivity, so you won't need to write code to inflate menu everytime.
public class Activity1 extends BaseActivity{
....
}
I believe each activity to have a unique menu. But there is a way you can do what you are trying to implement here.
You can create a base class that inherits from an Activity class and put all your menu logic on that base class.
And you can also refer to this answer, Reuse the Action Bar in all the activities of app and this article.
PS: I do not take credit for the answer, I just want to help. Cheers!
I'm a noob to android and I am using ActionBarSherlock's menu bar to access menus. Everything works fine on android APIs lower than API 11, but for any API 11 and Above the menu bar/menu items are unresponsive. The menu items highlight when I click them, but they don't execute. It's almost as if the menu items have lost their listener is there a setting that I forgot to implement? any help is greatly appreciated.
My Code:
//My Sherlock wrapper
ActionBarSherlock mSherlock = ActionBarSherlock.wrap(this);
//OnCreate
setTheme(R.style.Theme_Sherlock);
mSherlock.setContentView(R.layout.main);
//Menu Methods
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId())
{
case 1: // id from the xml file
Intent i = new Intent("com.bmoney.GSCC.OPTIONS");
startActivity(i);
return true; // we handled the click, dont pass it up the chain
case 2: // id from the xml file
Intent i2 = new Intent("com.bmoney.GSCC.PREFS");
startActivity(i2);
return true;
}
return false;
}
#Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
// TODO Auto-generated method stub
return mSherlock.dispatchCreateOptionsMenu(menu);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) { //<-- has Sherlock Menu Import
menu.add(0,1,0,"Preferences").setIcon(R.drawable.ic_action_example).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(0,2,0,"Help").setIcon(R.drawable.info).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
If I had to guess, your import for MenuItem is for android.view.MenuItem, and not the Sherlock equivalent.
If so, I suggest that:
You add #Override to onOptionsItemSelected()
You delete all android.view.* imports, then re-add them as Sherlock ones (e.g., via Ctrl-Shift-O in Eclipse)
You consolidate your two onCreateOptionsMenu() methods, using the one with the Sherlock import
I think the answer is that you need to "return true" when you handle the menu event.
Also, you might find if you restructure your method to the following that you will have an easier time reading and maintaining it.
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
case R.id.options: // id from the xml file
Intent i = new Intent("com.bmoney.GSCC.OPTIONS");
startActivity(i);
return true; // we handled the click, dont pass it up the chain
case R.id.prefs: // id from the xml file
Intent i = new Intent("com.bmoney.GSCC.PREFS");
startActivity(i);
return true;
}
return false;
}
I think you should add an OnMenuItemClickListener to your menu items when you add them in onCreateOptionsMenu. Then add the OnMenuItemSelected method and implement the code you have in onOptionItemSelected in the OnMenuItemSelected method. So you should have...
#Override
public boolean onMenuItemClick(MenuItem item) {
// Code from inside onoptionItemSelected
}
1. Background
I have a screen that has a
ShareActionProvider
and a
ViewPager
that uses fragments.
What I was hoping to do was get some information from inside the currently visible fragment to create an intent, I would then be able to set the intent on the ShareActionProvider.
This is the code I use to set the intent of the ShareActionProvider:
MenuItem actionItem = men.getMenu().findItem(R.id.menu_item_share_action_provider_action_bar);
ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
actionProvider.setShareIntent(createShareIntent(mProduct.mProduct));
I have tried using this in several places such as within these functions of the Fragment class :
onCreateView
onStart
I have also tried using it in these functions within the FragmentPagerAdapter class :
getItem
2. The Problem
Although the intent is actually getting set within the ShareActionProvider, the information that is obtained is for the next fragment (the one not currently being shown). For example:
If I have 4 fragments : frag1, frag2, frag3, frag4
and I am currently viewing "frag1" the ShareActionProvider will attempt to share "frag2". This is true until it reaches "frag4" where it will share the correct value.
My guess is that the fragment pager creates the current view and the next view (hidden), which is in turn setting the ShareActionProvider. If this is the case then where is the correct place to "setShareIntent"?
I stumble on this question while dealing with similar problem. 2 things about accepted solution:
Don't save reference to the fragment anywhere, especially in some list in the adapter
Don't create fields in the fragment, always store data you need in the Bundle so you can get it by using Fragment#getArguments
Now - with this in mind here's a simple solution: put your ShareActionProvider initialization code to onPrepareOptionsMenu call. Something like this:
#Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
MenuItem menuShare = menu.findItem(R.id.menuShare);
ShareActionProvider shareAction = (ShareActionProvider)
menuShare.getActionProvider();
shareAction.setShareIntent(createShareIntent());
}
protected Intent createShareIntent() {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
Job job = getArguments().getSerializable(JOB);
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, job.title);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, job.toText());
return shareIntent;
}
I managed to figure out how to do this myself. What I ended up doing is overriding the
OnPageChangeListener
in the fragmentactivity
private final OnPageChangeListener mOnPageChangeListener = new OnPageChangeListener() {
#Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
#Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
#Override
public void onPageSelected(int arg0) {
// TODO Auto-generated method stub
TestFragment frag = (TestFragment) adapter.mFragments.get(pager.getCurrentItem());
frag.setShareActionIntent();
}
};
http://developer.android.com/reference/android/widget/ShareActionProvider.html
the example from android sdk doc is:
// In Activity#onCreateOptionsMenu
public boolean onCreateOptionsMenu(Menu menu) {
// Get the menu item.
MenuItem menuItem = menu.findItem(R.id.my_menu_item);
// Get the provider and hold onto it to set/change the share intent.
mShareActionProvider = (ShareActionProvider) menuItem.getActionProvider();
// Set history different from the default before getting the action
// view since a call to MenuItem.getActionView() calls
// onCreateActionView() which uses the backing file name. Omit this
// line if using the default share history file is desired.
mShareActionProvider.setShareHistoryFileName("custom_share_history.xml");
. . .
}
// Somewhere in the application.
public void doShare(Intent shareIntent) {
// When you want to share set the share intent.
mShareActionProvider.setShareIntent(shareIntent);
}
I plan to use quick actions UI pattern in my application. Android Quick Actions UI Pattern . The quick action window needs a pivot view to stick to.
quickAction.show(View pivotView);
I intend to use quick action for the menu Item, I can get access to the item that is clicked.
But the problem is i need to reference a view from the menu item so that i can pass it to the quick action.
How can i get reference to a view in the menuItem that is selected.
You can achieve this by providing your menu item with an actionViewClass property in xml and then you will be able to get the pivot view u wanted. The code would be something like this
<item
android:id="#+id/menu_find"
android:showAsAction="ifRoom"
android:actionViewClass="android.widget.ImageButton"
/>
In your OnCreateOptionsMenu do this
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu_search, menu);
locButton = (ImageButton) menu.findItem(R.id.menu_find).getActionView();
locButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
createPopup();
mQuickAction.show(v);
}
});
return true;
}
Old question, but I ran into some issues with the actionViewClass attribute. For anyone who runs into this later...
Calling findViewById(R.id.mnu_item) in onOptionsItemSelected will return a View anchor.
QuickActions on the MenuItems aren't good design, but I found that they are the simplest way to implement submenus with custom backgrounds.
Inorder to get reference Views of menu items we need to do this,
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.section, menu);
new Handler().post(new Runnable() {
#Override
public void run() {
final View menuItemView = findViewById(R.id.action_preview);
// SOME OF YOUR TASK AFTER GETTING VIEW REFERENCE
}
});
return true;
}
An update for anyone that want to find the menu view item for other reasons (like I wanted).
If you have access to and use AppCompat's Toolbar there is a way. It's not the most efficient way, but it's the easiest way I've found to access the menu item's view.
public void onViewCreated(View view, #Nullable Bundle savedInstanceState) {
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
// Find Menu
for (int toolbarChildIndex = 0; toolbarChildIndex < toolbar.getChildCount(); toolbarChildIndex++) {
View view = toolbar.getChildAt(toolbarChildIndex);
// Found Menu
if (view instanceof ActionMenuView) {
ActionMenuView menuView = (ActionMenuView) view;
// All menu items
for (int menuChildIndex = 0; menuChildIndex < menuView.getChildCount(); menuChildIndex++) {
ActionMenuItemView itemView = (ActionMenuItemView) menuView.getChildAt(menuChildIndex);
// Do something to itemView...
}
}
}
}
Universal code which also works on Android 10
/**
* pass toolbar and menu item id, i.e. R.id.menu_refresh
*/
#Nullable
#Throws(
IllegalAccessException::class,
NoSuchFieldException::class
)
fun getMenuItemView(toolbar: Toolbar?, #IdRes menuItemId: Int): View? {
val mMenuView: Field = Toolbar::class.java.getDeclaredField("mMenuView")
mMenuView.setAccessible(true)
val menuView: Any? = mMenuView.get(toolbar)
(menuView as ViewGroup).children.forEach {
if(it.id == menuItemId) {
return it
}
}
return null
}
in the main activity class, best to override the onOptionsItemSelected(...) method; should be something as below:
public boolean onOptionsItemSelected(MenuItem item) {
// the id is of type int
int someId = item.getItemId();
// can use an if() or switch() statement to check if id is selected
//a Toast message can be used to show item is selected
}
Kotlin!!
override fun onCreateOptionsMenu(Menu menu): Boolean {
/*Adding menu items to action bar*/
menuInflater.inflate(R.menu.main, menu)
/*Getting menu item*/
val locButton: MenuItem = menu.findItem(R.id.menu_find)
/*Creating click listener*/
locButton.setOnMenuItemClickListener{
/*TODO: Handle it*/
true
}
return true;
}