I have this activity with some adapters , I would put it in tableLayout I already try some methods ,
unfortunately they didn't work , ( extends FragmentActivity , Convert Activity to Fragment with using onCreateView() )
`public class MainActivity_Delete extends AppCompatActivity` {
private SwipeMenuListView listView;
private ArrayList<Data> dataArrayList;
private ListAdapter listAdapter;
private Data data;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_delete);
listView = (SwipeMenuListView) findViewById(R.id.listview);
dataArrayList = new ArrayList<>();
listAdapter = new ListAdapter(this, dataArrayList);
listView.setAdapter(listAdapter);
listView.setMenuCreator(creator);
listView.setOnMenuItemClickListener(new SwipeMenuListView.OnMenuItemClickListener() {
#Override
public boolean onMenuItemClick(int position, SwipeMenu menu, int index) {
switch (index) {
case 0:
Toast.makeText(MainActivity_Delete.this, "Delete", Toast.LENGTH_SHORT).show();
Log.e("item", String.valueOf(listView.getAdapter().getItem(position)));
Log.e("name", String.valueOf(dataArrayList.get(position).getName()));
dataArrayList.remove(position);
listAdapter.notifyDataSetChanged();
break;
case 1:
// delete
break;
}
// false : close the menu; true : not close the menu
return false;
}
});
}
SwipeMenuCreator creator = new SwipeMenuCreator() {
#Override
public void create(SwipeMenu menu) {
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.parseColor("#F45557")));
// set item width
deleteItem.setWidth(150);
deleteItem.setTitle("Delete");
deleteItem.setTitleColor(Color.WHITE);
deleteItem.setTitleSize(15);
// add to menu
menu.addMenuItem(deleteItem);
}
};
}
There is android.app.ActivityGroup but this class has been deprecated since API level 13. So, in essence you cannot embed an activity in another activity. You can reuse layout files, however. See Re-using Layouts with <include/> The best option is, of course, to make use of fragments. They are the standard for such things.
Related
I have an app that creates custom array adapter called StabelArrayAdapter which based on the ArrayAdapter class. It is created in the onCreate() method of the activity and I want to refresh it from a menu when the view changes. I can't access the adapter from the menu and I can't make it public.
How can I refresh the list view from a menu?
Greg
public void onCreate(Bundle savedInstanceState) {
final StableArrayAdapter adapter = new StableArrayAdapter(this, android.R.layout.simple_list_item_1, listNames);
listview.setAdapter(adapter);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.id.list_add:
Toast.makeText(getApplicationContext(), "Add new list" , Toast.LENGTH_LONG)
.show();
return true;
case R.id.list_delete:
//change data here
final ListView listview = (ListView) findViewById(R.id.ListLists);
//--> Cannot resolve symbol 'adapter'
adapter.notifyDataSetChanged();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
You need to make the adapter a class member and then you can reference it.
private StableArrayAdapter adapter;
public void onCreate(Bundle savedInstanceState) {
adapter = new StableArrayAdapter(this, android.R.layout.simple_list_item_1, listNames);
listview.setAdapter(adapter);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.id.list_add:
Toast.makeText(getApplicationContext(), "Add new list" , Toast.LENGTH_LONG)
.show();
return true;
case R.id.list_delete:
//change data here
final ListView listview = (ListView) findViewById(R.id.ListLists);
adapter.notifyDataSetChanged();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
I am using the following example from the Android Developers website:
SwipeRefreshListFragment Official Example
I keep getting this error when running the application:
java.lang.RuntimeException: Unable to start activity ComponentInfo{example.com.app/example.com.app.MainActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:3562)
at android.view.ViewGroup.addView(ViewGroup.java:3415)
at android.view.ViewGroup.addView(ViewGroup.java:3360)
at android.view.ViewGroup.addView(ViewGroup.java:3336)
at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
at example.com.taskdata.activities.ActivityBase.onStart(ActivityBase.java:23)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5241)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
The code is correct, and it is similar to the example shown on the page. All my classes have the proper imports. And I haven't used setContentView() twice anywhere. Where would I need to add the removeView() method or is there a better way to complete this?
Appreciate any advice on this. I would like to know why the example is not working.
Attached is my code:
MainActivity
public class MainActivity extends ActivityBase {
public static final String TAG = "MainActivity";
// Whether log fragment is shown
private boolean mLogShown;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentTransaction fragmentTransaction = getSupportFragmentManager()
.beginTransaction();
TaskListFragment fragment = new TaskListFragment();
fragmentTransaction.replace(R.id.container, fragment).commit();
**MY GUESS IS THE PROBLEM IS HERE ^^^^**
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem logToggle = menu.findItem(R.id.action_settings);
logToggle.setVisible(findViewById(R.id.output) instanceof ViewAnimator);
logToggle.setTitle(mLogShown ? R.string.hide_log : R.string.show_log);
return super.onPrepareOptionsMenu(menu);
}
#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.
switch (item.getItemId()) {
case R.id.action_settings:
mLogShown = !mLogShown;
ViewAnimator output = (ViewAnimator) findViewById(R.id.output);
if (mLogShown) {
output.setDisplayedChild(1);
} else {
output.setDisplayedChild(0);
}
supportInvalidateOptionsMenu();
return true;
}
return super.onOptionsItemSelected(item);
}
/*
Create a chain of targets that will receive log data
*/
#Override
public void initializeLogging() {
// Wraps Android's native framework
LogWrapper logWrapper = new LogWrapper();
// Using Log, front-end to the logging chain, emulates android.util.Log method signatures
Log.setLogNode(logWrapper);
// Filter strips out everything except the message text
MessageOnlyLogFilter filter = new MessageOnlyLogFilter();
logWrapper.setNext(filter);
// On screen logging via fragment with a textview
LogFragment logFragment = (LogFragment) getSupportFragmentManager()
.findFragmentById(R.id.logFragment);
filter.setNext(logFragment.getLogView());
Log.i(TAG, "Ready");
}
}
SwipeRefreshListFragment
public class SwipeRefreshListFragment extends ListFragment {
private static final String TAG = "SwipeRefreshFragment";
// ListFragment where user can swipe up to refresh list
private SwipeRefreshLayout refreshTaskList;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Create list fragment's content view by calling super method
final View listFragmentView = super.onCreateView(inflater, container, savedInstanceState);
// Now create a SwipeRefreshLayout to wrap the fragment's content view
refreshTaskList = new ListFragmentSwipeRefreshLayout(container.getContext());
// Add the list fragment's content view to the SwipeRefreshLayout, making sure that it fills
// the SwipeRefreshLayout
refreshTaskList.addView(listFragmentView, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
// Now make sure that the SwipeRefreshLayout fills the Fragment
refreshTaskList.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
return listFragmentView;
}
// Set onRefreshListener to listen for iniated refreshes by user
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
refreshTaskList.setOnRefreshListener(listener);
}
// Method returns whether or not the SwipeRefreshLayout is refreshing or not
public boolean isRefreshing() {
return refreshTaskList.isRefreshing();
}
// Set whether the SwipeRefreshLayout should be displaying items it is refreshing
public void setRefreshing(boolean refreshing) {
refreshTaskList.setRefreshing(refreshing);
}
// Set the color scheme of the Refresh on SwipeRefreshLayout (colors shown at top when refreshing)
public void setColorScheme(int colorRes1, int colorRes2, int colorRes3, int colorRes4) {
refreshTaskList.setColorScheme(colorRes1, colorRes2, colorRes3, colorRes4);
}
// Return the Fragment's Widget
public SwipeRefreshLayout getSwipeRefreshLayout() {
return refreshTaskList;
}
/*
Subclass of SwipeRefreshLayout, for use in ListFragment. Needed because SwipeRefreshLayout only supports a single
child, which it expects to be the one which triggers refreshes. In this case the layout's child is content view
returned from ListFragment in onCreateView() which is a ViewGroup
To enable 'swipe-to-refresh' suppoer we need to override the default behavior and properly signal when a gesture is
possible. This is done by override canChildScrollUp()
*/
private class ListFragmentSwipeRefreshLayout extends SwipeRefreshLayout {
public ListFragmentSwipeRefreshLayout(Context context) {
super(context);
}
#Override
public boolean canChildScrollUp() {
final ListView listView = getListView();
if (listView.getVisibility() == View.VISIBLE) {
return canListViewScrollUp(listView);
} else {
return false;
}
}
}
/*
Utility method to check whether a ListView can scroll up from it's current position.
Handles perform version differences, providing backwards compatability where needed.
*/
private static boolean canListViewScrollUp(ListView listView) {
if (Build.VERSION.SDK_INT >= 14) {
// For IceCream Sandwich and above we can call canScrollVertically() to determine this
return ViewCompat.canScrollVertically(listView, -1); // Scroll in the -1 direction
} else {
// Pre-ICS we need to manually check the first visible item and the child's view top value
return listView.getChildCount() > 0 && (listView.getFirstVisiblePosition() > 0
|| listView.getChildAt(0).getTop() < listView.getPaddingTop());
}
}
}
SwipeRefreshListFragmentFragment
public class SwipeRefreshListFragmentFragment extends SwipeRefreshListFragment {
private final static String TAG = "TaskListFragment";
private static final int LIST_ITEM_COUNT = 20;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Notify System to allow options menu for this Fragment
setHasOptionsMenu(true);
}
#Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
/*
Create ArrayAdapter to contain the data for the Listview. Each item in the Listview
uses the System defined list_item.xml
*/
ListAdapter adapter = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,
Tasks.randomList(LIST_ITEM_COUNT)
);
// Set the adapter between ListView and the backing data
setListAdapter(adapter);
/*
Implement SwipeRefreshLayout.OnRefreshListener when users do the 'swipe-to-refresh'
gesture, SwipeRefreshLayout invokes onRefresh(). In onRefresh(), call a method that
refreshes the content. Call the same method in response to the Refresh action from the
action bar.
*/
setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
#Override
public void onRefresh() {
Log.i(TAG, "onRefresh called from SwipeRefreshLayout");
initiateRefresh();
}
});
}
#Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.main_menu, menu);
}
/*
Responds to user's selection of its refresh action item, Start the SwipeRefreshLayout
progress bar, then initiate the background task that refreshes the content.
A color scheme menu item used for demonstrating the use of SwipeRefreshLayout's color scheme
Color scheme should match branding
*/
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
Log.i(TAG, "Refresh menu item selected");
// We make sure that the SwipeRefreshLayout is displaying its refreshing indicator
if (!isRefreshing()) {
setRefreshing(true);
}
// Start our refresh background task
initiateRefresh();
return true;
case R.id.menu_color_scheme_1:
Log.i(TAG, "setColorScheme #1");
item.setChecked(true);
// Change the colors displayed by the SwipeRefreshLayout by providing it with 4
// color resource Ids
setColorScheme(R.color.color_scheme_1_1, R.color.color_scheme_1_2,
R.color.color_scheme_1_3, R.color.color_scheme_1_4);
return true;
case R.id.menu_color_scheme_2:
Log.i(TAG, "setColorScheme #2");
item.setChecked(true);
// Change the colors displayed by the SwipeRefreshLayout by providing it with 4
// color resource ids
setColorScheme(R.color.color_scheme_2_1, R.color.color_scheme_2_2,
R.color.color_scheme_2_3, R.color.color_scheme_2_4);
return true;
case R.id.menu_color_scheme_3:
Log.i(TAG, "setColorScheme #3");
item.setChecked(true);
// Change the colors displayed by the SwipeRefreshLayout by providing it with 4
// color resource ids
setColorScheme(R.color.color_scheme_3_1, R.color.color_scheme_3_2,
R.color.color_scheme_3_3, R.color.color_scheme_3_4);
return true;
}
return super.onOptionsItemSelected(item);
}
/*
By abstracting the refresh process to a single method, the app allows both the SwipeGestureLayout onRefresh()
method and the Refresh action item to refresh the content
*/
private void initiateRefresh() {
Log.i(TAG, "initiateRefresh");
/*
Execute the background task, which uses AsyncTask to load data
*/
new BackgroundTask().execute();
}
/*
When the asynctask finishes, it finishes onRefreshComplete() which updates the data in the ListAdapter
and turns off the progress bar
*/
private void onRefreshComplete(List<String> result) {
Log.i(TAG, "onRefreshComplete");
// Remove all items from the ListAdapter, and then replace them with new items
ArrayAdapter<String> adapter = (ArrayAdapter<String>) getListAdapter();
adapter.clear();
for (String task : result) {
adapter.add(task);
}
// Stop refreshing the indicator
setRefreshing(false);
}
/*
AsyncTask which simulates a long running task to fetch new construction tasks
*/
private class BackgroundTask extends AsyncTask<Void, Void, List<String>> {
static final int TASK_DURATION = 3 * 1000; // 3 seconds
#Override
protected List<String> doInBackground(Void... params) {
// Sleep for a small amount of time to simulate a background task
try {
Thread.sleep(TASK_DURATION);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Return a new random list of tasks
return Tasks.randomList(LIST_ITEM_COUNT);
}
#Override
protected void onPostExecute(List<String> result) {
super.onPostExecute(result);
// Tell the fragment that the refresh has completed
onRefreshComplete(result);
}
}
}
ActivityBase
public class ActivityBase extends FragmentActivity {
public static final String TAG = "ActivityBase";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
#Override
protected void onStart() {
super.onStart();
initializeLogging();
}
// Set targets to receive data
public void initializeLogging() {
// Using Log, front-end to the logging chain, emulates android.util.log method signatures
// Wraps Android's native log framework
LogWrapper logWrapper = new LogWrapper();
Log.setLogNode(logWrapper);
Log.i(TAG, "Ready");
}
}
SwipeRefreshLayout can have only single child.if you want to add multiple child(which is not a good practice,and should be avoided) try making a linearlayout and adding childs to them.
I'm trying to change the layout of my activity according to my selection inside the spinner.
But after the first selection, the spinner become white and I'm not able to decide another selection.
The code I'm using is the following:
public class MainActivity extends Activity implements OnItemSelectedListener {
Spinner spinner;
String[] options = { "Modulo1", "Modulo2" };
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> adapter_state = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, options);
adapter_state
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter_state);
spinner.setOnItemSelectedListener(this);
}
int check = 0;
public void onItemSelected(AdapterView<?> parent, View view, int position,
long id) {
check = check + 1;
if (check > 1) {
int selState = spinner.getSelectedItemPosition();
switch (selState) {
case 0:
setContentView(R.layout.activity_main);
break;
case 1:
setContentView(R.layout.activity2_main);
break;
}
}
}
#Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
//
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Any suggestion?
Thanks
The spinner you are referring to is in your first activity. After you have replaced the content, the spinner isn't there anymore. If you have another spinner in the second layout, you have to reconnect it and set the listener again.
Basically you have to run your onCreate stuff after every setContentView...
As a side note, whatever you are trying to do, this is probably not the way to go. To show another full layout, better use another activity.
In my application, I show some data to the user depending on which category he chooses. For that, I'm using ActionBarSherlock, to display a menu of categories he can choose from. When one category is clicked, this content is loaded. What I now want to do is enable a multi-select option, with checkboxes, and an OK button to trigger the content loading. I've been searching for some time and couldn't figure out how to enable this multi-select menu. Below is part of my current code
public class CategoriesActivity extends SherlockActivity implements
ActionBar.OnNavigationListener {
private ArrayList<Category> categoryList;
#Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(Application.THEME);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_ringtones);
Context context = getSupportActionBar().getThemedContext();
categoryList = new ArrayList<Category>();
ArrayAdapter<Category> adapter = new ArrayAdapter<Category>(context,
R.layout.sherlock_spinner_item, categoryList);
adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setListNavigationCallbacks(adapter, this);
getSupportActionBar().setIcon(R.drawable.abs__ic_search);
// By default, load data for the first category
loadCategoryData(categoryList.get(0).getId());
}
#Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
loadCategoryData(categoryList.get(itemPosition).getId());
return false;
}
I have a listview populated with data from a cursor using SimpleCursorAdapter. I want to make it so I can select multiple items with a checkbox against each item but I can only get it to check a single item at a time i.e. each time I select an item, it will clear the currently selected item.
It works fine if I populate the listview using an ArrayAdapter. I can select multiple items. So I dont know why it doesn't work with the SimpleCursorAdapter.
This is being created in a DialogFragment if that matters.
Really pulling my hair out on this, pleae help!!
Here's the code:
Cursor attributesCursor = mDBHelper.getItemAttributesbyType(menuID, itemID, "M");
getActivity().startManagingCursor(attributesCursor);
ListView lv = new ListView(this.getActivity());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
lv.setLayoutParams(params);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
getActivity(), android.R.layout.simple_list_item_multiple_choice,
attributesCursor, new String[] { "AttributeDescription" },
new int[] { android.R.id.text1 },0);
attributesLinearLayout.addView(lv);
lv.setAdapter(adapter);
lv.setItemsCanFocus(false);
lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
Edit :
Just to add some extra info, the multi choice listview works if i use this code, where "items" is a simple String array:
lv.setAdapter(new ArrayAdapter(this.getActivity(),
android.R.layout.simple_list_item_multiple_choice, items));
Also, this listview is being dynamically added to an existing Linearlayout (attributesLinearLayout) in a dialogfragment which contains other controls. I also tried extending other adapters, including the array adapter and customer item layouts but that again didnt allow me to select multiple items.
Please help!!
I would use the Contextual Action mode in this project if you wish to select multiple items in a listview. This is how it is done.
First of all, the code must extend a ListActivity and implement an ActionMode.Callback
In the onCreate medthod you need to code the following:
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
String[] values = new String[] { "data list goes here" };
MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this, values);
setListAdapter(adapter);
getListView().setOnItemLongClickListener(new OnItemLongClickListener() {
#Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (mActionMode != null) {
return false;
}
selectedItem = position;
// Start the CAB using the ActionMode.Callback defined above
mActionMode = MyListActivityActionbar.this.startActionMode(MyListActivityActionbar.this);
view.setSelected(true);
return true;
}
});
}
The you need to call the show method:
private void show() {
Toast.makeText(MyListActivityActionbar.this, String.valueOf(selectedItem), Toast.LENGTH_LONG).show();
}
The following needs to be called each time the action mode is shown. It is always called after onCreateActionMode, but may be called multiple times if the mode is invalidated:
#Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false; // Return false if nothing is done
}
Then when the user selects a list item, the following method needs to be called:
#Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.menuitem1_show:
show();
// Action picked, so close the CAB
mode.finish();
return true;
default:
return false;
}
}
Finally when the user exits the selection:
#Override
public void onDestroyActionMode(ActionMode mode) {
mActionMode = null;
selectedItem = -1;
}