Search Results

Search found 313 results on 13 pages for 'menuitem'.

Page 10/13 | < Previous Page | 6 7 8 9 10 11 12 13  | Next Page >

  • Errorprovider shows error on using windows close button(X)

    - by Pankaj Kumar
    Hi guys, Is there any way to turn the damned error provider off when i try to close the form using the windows close button(X). It fires the validation and the user has to fill all the fields before he can close the form..this will be a usability issue because many tend to close the form using the (X) button. i have placed a button for cancel with causes validation to false and it also fires a validation. i found someone saying that if you use Form.Close() function validations are run... how can i get past this annoying feature. i have a MDI sturucture and show the form using CreateExam.MdiParent = Me CreateExam.Show() on the mdi parent's menuitem click and have this as set validation Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating If String.IsNullOrEmpty(TextBox1.Text) Then Err.SetError(TextBox1, "required") e.Cancel = True End If If TextBox1.Text.Contains("'") Then Err.SetError(TextBox1, "Invalid Char") e.Cancel = True End If End Sub Any help is much appreciated. googling only showed results where users were having problem using a command button as close button and that too is causing problem in my case

    Read the article

  • how to get menu item text using vc++?

    - by pasham
    My problem is "how to know which menu item is clicked in visual studio 2005". i wrote some code using hook for monitoring WM_MENUSELECT..it is working fine for notepad,visual c++6.0 applications but when i use this code for VS-2005 it is not woking(these type of msgs are not generating when i click menuitem in VS2005).. is there any other way to achive this... please help me on this..i am really getting irritating becoz i am struggling from last one month... any help is greatly appreciated...

    Read the article

  • Locating binding errors

    - by softengine
    I'm dealing with a large WPF application that is outputting a large number of binding errors. A typical error looks like this: System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment') Problem is I don't know where in the app this is coming from. Searching the entire solution for AncestorType={x:Type ItemsControl} doesn't necessary help since I still don't know which result is the culprit. I've tried setting PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.All; but the extra information doesn't help locate the problematic bindings. File names and line numbers is really what I need. Is there anyway to get this information?

    Read the article

  • Menu item ID is not recognized

    - by Alex Farber
    menu/activity_main.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_settings" android:title="@string/menu_settings" android:showAsAction="never" /> <item android:id="@+id/menu_save_log" android:title="@string/menu_save_log" android:showAsAction="never" /> </menu> MainActivity.java: //@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_settings: // OK break; case R.id.menu_save_log: // menu_save_log cannot be resolved or is not a field break; } return true; } Why menu_save_log is not recognized?

    Read the article

  • Tracking finger move in order to rotate a triangle : tracking is not perfect

    - by Laurent BERNABE
    I've written a custom view, with the OpenGL_1 technology, in order to let user rotate a red triangle just by dragging it along x axis. (Will give a rotation around Y axis). It works, but there is a bit of latency when dragging from one direction to the other (without releasing the mouse/finger). So it seems that my code is not yet "goal perfect". (I am convinced that no code is perfect in itself). I thought of using a quaternion, but maybe it won't be so usefull : must I really use a Quaternion (or a kind of Matrix) ? I've designed application for Android 4.0.3, but it could fit into Android api 3 (Android 1.5) as well (at least, I think it could). So here is my main layout : activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <com.laurent_bernabe.android.triangletournant3d.MyOpenGLView android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> Here is my main activity : MainActivity.java package com.laurent_bernabe.android.triangletournant3d; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } And finally, my OpenGL view MyOpenGLView.java package com.laurent_bernabe.android.triangletournant3d; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import android.graphics.Point; import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView.Renderer; import android.opengl.GLU; import android.util.AttributeSet; import android.view.MotionEvent; public class MyOpenGLView extends GLSurfaceView implements Renderer { public MyOpenGLView(Context context, AttributeSet attrs) { super(context, attrs); setRenderer(this); } public MyOpenGLView(Context context) { this(context, null); } @Override public boolean onTouchEvent(MotionEvent event) { int actionMasked = event.getActionMasked(); switch(actionMasked){ case MotionEvent.ACTION_DOWN: savedClickLocation = new Point((int) event.getX(), (int) event.getY()); break; case MotionEvent.ACTION_UP: savedClickLocation = null; break; case MotionEvent.ACTION_MOVE: Point newClickLocation = new Point((int) event.getX(), (int) event.getY()); int dx = newClickLocation.x - savedClickLocation.x; angle += Math.toRadians(dx); break; } return true; } @Override public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0f, 0f, 5f, 0f, 0f, 0f, 0f, 1f, 0f ); gl.glRotatef(angle, 0f, 1f, 0f); gl.glColor4f(1f, 0f, 0f, 0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, triangleCoordsBuff); gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); GLU.gluPerspective(gl, 60f, (float) width / height, 0.1f, 10f); gl.glMatrixMode(GL10.GL_MODELVIEW); } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glEnable(GL10.GL_DEPTH_TEST); gl.glClearDepthf(1.0f); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); buildTriangleCoordsBuffer(); } private void buildTriangleCoordsBuffer() { ByteBuffer buffer = ByteBuffer.allocateDirect(4*triangleCoords.length); buffer.order(ByteOrder.nativeOrder()); triangleCoordsBuff = buffer.asFloatBuffer(); triangleCoordsBuff.put(triangleCoords); triangleCoordsBuff.rewind(); } private float [] triangleCoords = {-1f, -1f, +1f, -1f, +1f, +1f}; private FloatBuffer triangleCoordsBuff; private float angle = 0f; private Point savedClickLocation; } I don't think I really have to give you my manifest file. But I can if you think it is necessary. I've just tested on Emulator, not on real device. So, how can improve the reactivity ? Thanks in advance.

    Read the article

  • MouseOver Trigger firing on ContextMenu with overridden ControlTemplate. Where is it coming from?

    - by Dabblernl
    I have this very simple ControlTemplate: <ControlTemplate TargetType="{x:Type ContextMenu}"> <Border Name="Border" Background="{StaticResource BlueBackground}" BorderBrush="LightBlue" CornerRadius="10" BorderThickness="1" > <StackPanel IsItemsHost="True"/> </Border> </ControlTemplate> I made it to create a nifty jawdroppingly beautiful rounded corner! However, when I point the mouse over a contextmenu a MouseOver Trigger fires from somewhere that draws a terribly ugly nearly square border on top of my nifty rounded border! Where is it coming from?? EDIT: The most likely cause is that the ContextMenu is an ItemsControl that holds MenuItems, even when my ContextMenu holds a single UserControl. So the UserControl is seen as a MenuItem and highlighted when the IsMouseOver==true! What is the easiest way to disable this behaviour?

    Read the article

  • ff extension. how to pass parameters to a function in the oncommand attribute in menu

    - by encryptor
    I have a ff extension which creates a popup and shows dynamic data in it. basically when the popup opens a js function is run which then constructs the popup list by appending the items like this var myMenuPopup = document.getElementById("file-popup4"); newItem = document.createElement("menuitem"); newItem.setAttribute("label", namelist[m]); newItem.setAttribute("id", "item" + m); Now I need to have the click functionality too on these newly added menuitems. putting the atttribute and forming the function is easy. I can have a function to be run when they are clicked. But i need to pass namelist[i] to the function and it will act according to the namelist parameter.If i do: newItem.setAttribute("oncommand" , finalclick(namelist[m])); it runs the function everytime the popup opens runs the function without even clicking on it on the other hand if i use quotes i.i if i do newItem.setAttribute("oncommand" , "finalclick(namelist[m])"); it doesnot open even on clicking giving error : namelist is not defined.

    Read the article

  • Delete image file used by XAML

    - by Frode Lillerud
    I'm trying to delete a Image file in WPF, but WPF locks the file. <Image Source="C:\person.gif" x:Name="PersonImage"> <Image.ContextMenu> <ContextMenu> <MenuItem Header="Delete..." x:Name="DeletePersonImageMenuItem" Click="DeletePersonImageMenuItem_Click"/> </ContextMenu> </Image.ContextMenu> </Image> And the Click handler just looks like this: private void DeletePersonImageMenuItem_Click(object sender, RoutedEventArgs e) { System.IO.File.Delete(@"C:\person.gif"); } But, when I try to delete the file it is locked and cannot be removed. Any tips on how to delete the file?

    Read the article

  • ListView and undeterminate ProgressBar

    - by Spredzy
    Sorry for the question it might sounds stupid, But: how do you activate a ProgressBar according to the cell you just cliked on ? I have a list view, with a menu that shows after a long press. When I click on one of my option I would like to display the ProgressBar in the listView according to the cell I clicked on. It is currently always displaying the one of my first cell, whatever I am doing public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getOrder()) { case 0: mProgressBar = (ProgressBar)findViewById(R.id.welcome_progressbar); mProgressBar.setVisibility(View.VISIBLE); ... some execution .... return true; case 1: ... Does anyone see anything wrong?

    Read the article

  • Silverlight DRY when animating multiple UserControls on main Navigation page.

    - by Tobias op den Brouw
    Hello all. Starting with Silverlight development. Yet to read a good Silverlight book: suggestions welcome. I have a main GUI screen where 7 user controls (menu items) 'swoop' into sight, all along their own path. I have the user controls nicely seperated and behaving well. Having multiple storyboards (1 each for each menuitem) with multiple keyframe animations (X,Y,height, width) in one .XAML is not sitting well with me. Repeating all those property values is hideous, neverthemind maintenance. I've tried to move values into the app.xaml and set animation durations with style keys, but having limited success. Can anyone suggest a nice way of making this cleaner? Refactor the storyboards out to their own control? Property values in resources? Dynamic building in codebehind? Referring me to a how-to site is fine as well. Tx!

    Read the article

  • FF extension: displaying an array of string elements in a sidebar

    - by sujay-jain
    I am developing a ff extension which displays a list of elements from an array (dynamic) in the sidebar. The array is dynamic and needs to be constructed in a function everytime the sidebar is opened (or any other event handler). Later, i will need to implement link functionality on parts of the string. What is the best way to go about this? I have created an empty sidebar and just know the label element as of now. menu, and menuitem dont work. What other elements can i use to display text in a good way which supports dynamic contruction. Is there some good tutorial/sample extension which i can see and learn?

    Read the article

  • ListView not showing up in fragment

    - by aindurti
    When I insert a listview in a fragment in my application, it doesn't show up after I populate it with items. In fact, the application crashes due to a NullPointerException. Can anybody help me? Here is the detail activity from which I show the fragments. package com.example.sample; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.NavUtils; import android.widget.ArrayAdapter; import android.widget.ListView; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.MenuItem; /** * An activity representing a single Course detail screen. This activity is only * used on handset devices. On tablet-size devices, item details are presented * side-by-side with a list of items in a {@link CourseListActivity}. * <p> * This activity is mostly just a 'shell' activity containing nothing more than * a {@link CourseDetailFragment}. */ public class CourseDetailActivity extends SherlockFragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_course_detail); // Show the Up button in the action bar. ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // initiating both tabs and set text to it. ActionBar.Tab assignTab = actionBar.newTab().setText("Assignments"); ActionBar.Tab schedTab = actionBar.newTab().setText("Schedule"); ActionBar.Tab contactTab = actionBar.newTab().setText("Contact"); // Create three fragments to display content Fragment assignFragment = new Assignments(); Fragment schedFragment = new Schedule(); Fragment contactFragment = new Contact(); assignTab.setTabListener(new MyTabsListener(assignFragment)); schedTab.setTabListener(new MyTabsListener(schedFragment)); contactTab.setTabListener(new MyTabsListener(contactFragment)); actionBar.addTab(assignTab); actionBar.addTab(schedTab); actionBar.addTab(contactTab); ListView listView = (ListView) findViewById(R.id.assignlist); String[] values = new String[] { "Android", "iPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2" }; // First paramenter - Context // Second parameter - Layout for the row // Third parameter - ID of the TextView to which the data is written // Forth - the Array of data ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); // Assign adapter to ListView listView.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, CourseListActivity.class)); return true; } return super.onOptionsItemSelected(item); } class MyTabsListener implements ActionBar.TabListener { public Fragment fragment; public Fragment fragment2; public MyTabsListener(Fragment fragment) { this.fragment = fragment; } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.replace(R.id.main_across, fragment); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { ft.remove(fragment); } } } The fragment that I am currently trying to get working is called the Assignments fragment. As you can see in the CourseDetailActvity, I populate smaple items in the listview to see if it the listview shows up. The fragment gets inflated properly, but when I try to add items to the listview, the application crashes! Here is the logcat. 11-17 11:54:28.037: E/AndroidRuntime(282): FATAL EXCEPTION: main 11-17 11:54:28.037: E/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sample/com.example.sample.CourseDetailActivity}: java.lang.NullPointerException 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.os.Handler.dispatchMessage(Handler.java:99) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.os.Looper.loop(Looper.java:123) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.main(ActivityThread.java:4627) 11-17 11:54:28.037: E/AndroidRuntime(282): at java.lang.reflect.Method.invokeNative(Native Method) 11-17 11:54:28.037: E/AndroidRuntime(282): at java.lang.reflect.Method.invoke(Method.java:521) 11-17 11:54:28.037: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 11-17 11:54:28.037: E/AndroidRuntime(282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 11-17 11:54:28.037: E/AndroidRuntime(282): at dalvik.system.NativeStart.main(Native Method) 11-17 11:54:28.037: E/AndroidRuntime(282): Caused by: java.lang.NullPointerException 11-17 11:54:28.037: E/AndroidRuntime(282): at com.example.sample.CourseDetailActivity.onCreate(CourseDetailActivity.java:66) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-17 11:54:28.037: E/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 11-17 11:54:28.037: E/AndroidRuntime(282): ... 11 more

    Read the article

  • creating an options menu with quit application function

    - by Domen Tomažin
    Hello, I'm writing an application for android and I would like to insert an options menu, that would have only one function and that is to quit an application. My options_menu.xml looks like this (I created a new folder under res called menu - just like the instructions said): Than I added the following code to my java class file: @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.quit: finish(); return true; default: return super.onOptionsItemSelected(item); } I also defined the @string/quit in values - strings.xml file, but it still says that there is an error: C:\Users\Domen\workspace\Lovne Dobe1.1\res\menu\options_menu.xml:3: error: Error: No resource found that matches the given name (at 'title' with value '@string/quit') So if anybody can help I would be very grateful.

    Read the article

  • Dojo: dijit.form.DropDownButton content not positioned correctly

    - by Staale
    I have the following setup: <div dojoType="dijit.form.DropDownButton"> <span>Modify</span> <div dojoType="dijit.Menu"> <div dojoType="dijit.MenuItem">...</div> </div> </div> There is of course more to the final setup. The problem I Have is that if I scroll in the page, the popup menu under the DropDownButton comes much higher in the page. I suspect that it's subtracting the scrollOffset for the position off the popup, while in reality that is not needed. Anyone got any tips about how to fix this? I would prefer to use declerative html syntax for using Dojo widgets. == Fixed == I updated to dojo 1.4.2 and this got fixed then.

    Read the article

  • Reading data from database and binding them to custom ListView

    - by N.K.
    I try to read data from a database i have made and to show some of the data in a row at a custom ListView. I can not understand what is my mistake. This is my code: public class EsodaMainActivity extends Activity { public static final String ROW_ID = "row_id"; //Intent extra key private ListView esodaListView; // the ListActivitys ListView private SimpleCursorAdapter esodaAdapter; // adapter for ListView DatabaseConnector databaseConnector = new DatabaseConnector(EsodaMainActivity.this); // called when the activity is first created @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_esoda_main); esodaListView = (ListView)findViewById(R.id.esodaList); esodaListView.setOnItemClickListener(viewEsodaListener); databaseConnector.open(); //Cursor cursor= databaseConnector.query("esoda", new String[] // {"name", "amount"}, null,null,null); Cursor cursor=databaseConnector.getAllEsoda(); startManagingCursor(cursor); // map each esoda to a TextView in the ListView layout // The desired columns to be bound String[] from = new String[] {"name","amount"}; // built an String array named "from" //The XML defined views which the data will be bound to int[] to = new int[] { R.id.esodaTextView, R.id.amountTextView}; // built an int array named "to" // EsodaMainActivity.this = The context in which the ListView is running // R.layout.esoda_list_item = Id of the layout that is used to display each item in ListView // null = // from = String array containing the column names to display // to = Int array containing the column names to display esodaAdapter = new SimpleCursorAdapter (this, R.layout.esoda_list_item, cursor, from, to); esodaListView.setAdapter(esodaAdapter); // set esodaView's adapter } // end of onCreate method @Override protected void onResume() { super.onResume(); // call super's onResume method // create new GetEsodaTask and execute it // GetEsodaTask is an AsyncTask object new GetEsodaTask().execute((Object[]) null); } // end of onResume method // onStop method is executed when the Activity is no longer visible to the user @Override protected void onStop() { Cursor cursor= esodaAdapter.getCursor(); // gets current cursor from esodaAdapter if (cursor != null) cursor.deactivate(); // deactivate cursor esodaAdapter.changeCursor(null); // adapter now has no cursor (removes the cursor from the CursorAdapter) super.onStop(); } // end of onStop method // this class performs db query outside the GUI private class GetEsodaTask extends AsyncTask<Object, Object, Cursor> { // we create a new DatabaseConnector obj // EsodaMainActivity.this = Context DatabaseConnector databaseConnector = new DatabaseConnector(EsodaMainActivity.this); // perform the db access @Override protected Cursor doInBackground(Object... params) { databaseConnector.open(); // get a cursor containing call esoda return databaseConnector.getAllEsoda(); // the cursor returned by getAllContacts() is passed to method onPostExecute() } // end of doInBackground method // here we use the cursor returned from the doInBackground() method @Override protected void onPostExecute(Cursor result) { esodaAdapter.changeCursor(result); // set the adapter's Cursor databaseConnector.close(); } // end of onPostExecute() method } // end of GetEsodaTask class // creates the Activity's menu from a menu resource XML file @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.esoda_menu, menu); // inflates(eµf?s?) esodamainactivity_menu.xml to the Options menu return true; } // end of onCreateOptionsMenu() method //handles choice from options menu - is executed when the user touches a MenuItem @Override public boolean onOptionsItemSelected(MenuItem item) { // creates a new Intent to launch the AddEditEsoda Activity // EsodaMainActivity.this = Context from which the Activity will be launched // AddEditEsoda.class = target Activity Intent addNewEsoda = new Intent(EsodaMainActivity.this, AddEditEsoda.class); startActivity(addNewEsoda); return super.onOptionsItemSelected(item); } // end of method onPtionsItemSelected() // event listener that responds to the user touching a esoda's name in the ListView OnItemClickListener viewEsodaListener = new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // create an intent to launch the ViewEsoda Activity Intent viewEsoda = new Intent(EsodaMainActivity.this, ViewEsoda.class); // pass the selected esoda's row ID as an extra with the Intent viewEsoda.putExtra(ROW_ID, arg3); startActivity(viewEsoda); // start viewEsoda.class Activity } // end of onItemClick() method }; // end of viewEsodaListener } // end of EsodaMainActivity class The statement: Cursor cursor=databaseConnector.getAllEsoda(); queries all data (columns) From the data I want to show at my custom ListView 2 of them: "name" and "amount". But I still get a debugger error. Please help.

    Read the article

  • No view for id for fragment

    - by guillaume
    I'm trying to use le lib SlidingMenu in my app but i'm having some problems. I'm getting this error: 11-04 15:50:46.225: E/FragmentManager(21112): No view found for id 0x7f040009 (com.myapp:id/menu_frame) for fragment SampleListFragment{413805f0 #0 id=0x7f040009} BaseActivity.java package com.myapp; import android.support.v4.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.Menu; import android.view.MenuItem; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity; public class BaseActivity extends SlidingFragmentActivity { private int mTitleRes; protected ListFragment mFrag; public BaseActivity(int titleRes) { mTitleRes = titleRes; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(mTitleRes); // set the Behind View setBehindContentView(R.layout.menu_frame); if (savedInstanceState == null) { FragmentTransaction t = this.getSupportFragmentManager().beginTransaction(); mFrag = new SampleListFragment(); t.replace(R.id.menu_frame, mFrag); t.commit(); } else { mFrag = (ListFragment) this.getSupportFragmentManager().findFragmentById(R.id.menu_frame); } // customize the SlidingMenu SlidingMenu slidingMenu = getSlidingMenu(); slidingMenu.setMode(SlidingMenu.LEFT); slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); slidingMenu.setShadowWidthRes(R.dimen.slidingmenu_shadow_width); slidingMenu.setShadowDrawable(R.drawable.slidingmenu_shadow); slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset); slidingMenu.setFadeDegree(0.35f); slidingMenu.setMenu(R.layout.slidingmenu); getActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: toggle(); return true; } return super.onOptionsItemSelected(item); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } } menu.xml <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:name="com.myapp.SampleListFragment" android:layout_width="match_parent" android:layout_height="match_parent" > </fragment> menu_frame.xml <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menu_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> SampleListFragment.java package com.myapp; import android.content.Context; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class SampleListFragment extends ListFragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.list, null); } public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); SampleAdapter adapter = new SampleAdapter(getActivity()); for (int i = 0; i < 20; i++) { adapter.add(new SampleItem("Sample List", android.R.drawable.ic_menu_search)); } setListAdapter(adapter); } private class SampleItem { public String tag; public int iconRes; public SampleItem(String tag, int iconRes) { this.tag = tag; this.iconRes = iconRes; } } public class SampleAdapter extends ArrayAdapter<SampleItem> { public SampleAdapter(Context context) { super(context, 0); } public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.row, null); } ImageView icon = (ImageView) convertView.findViewById(R.id.row_icon); icon.setImageResource(getItem(position).iconRes); TextView title = (TextView) convertView.findViewById(R.id.row_title); title.setText(getItem(position).tag); return convertView; } } } MainActivity.java package com.myapp; import java.util.ArrayList; import beans.Tweet; import database.DatabaseHelper; import adapters.TweetListViewAdapter; import android.os.Bundle; import android.widget.ListView; public class MainActivity extends BaseActivity { public MainActivity(){ super(R.string.app_name); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ListView listview = (ListView) findViewById(R.id.listview_tweets); DatabaseHelper db = new DatabaseHelper(this); ArrayList<Tweet> tweets = db.getAllTweets(); TweetListViewAdapter adapter = new TweetListViewAdapter(this, R.layout.listview_item_row, tweets); listview.setAdapter(adapter); setSlidingActionBarEnabled(false); } } I don't understand why the view menu_frame is not found because I have a view with the id menu_frame and this view is a child of the layout menu_frame.

    Read the article

  • Notepad Tutorial: deleteDatabase() function

    - by FelixA
    Hello I have a short question to the notepad tutorial on the android website. I wrote a simple function in the tutorial code to delete the whole database. It looks like this: DataHelper.java public void deleteDatabase() { this.mDb.delete(DATABASE_NAME, null, null); } Notepadv1.java @Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, DELETE_ID, 0, "Delete whole Database"); return result; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case DELETE_ID: mDbHelper.deleteDatabase(); return true; } return super.onOptionsItemSelected(item); } But when I run the app and try to delete the database I will get this error in LogCat: sqlite returned: error code = 1, msg= no such table: data Can you help how to fix this problem. It seems that the function deleteDatabase can not reach the database. Thank you very much. Felix

    Read the article

  • Context Menu SourceControl Error

    - by developer
    Hi All, I am trying to use contextmenu in my textbox control and I want to bind the textbox value to the value selected in context menu,below is my code <Window.CommandBindings> <CommandBinding Command="local:MyPanel.ChangeTextboxValue" Executed="ChangeTextboxValue_Executed"/> </Window.CommandBindings> CODE-BEHIND public static RoutedUICommand ChangeTextboxValue = new RoutedUICommand ("ChangeTextboxValue", "ChangeTextboxValue", typeof(MyPanel)); private void ChangeTextboxValue_Executed(object sender, ExecutedRoutedEventArgs e) { string oldvalue = Convert.ToString(e.Parameter); (((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox).Text = oldvalue; } oldvalue is the value I want the textbox controls value to change to. I am trying to use above code but it gives me the error, 'Object reference not set to an instance of object'. I tried to debug the app and I get ContextMenu as null.. .Any ideas why??

    Read the article

  • how to call context menu

    - by gdonald
    I open my context menu like this: private OnClickListener optionsClickListener = new OnClickListener() { public void onClick( View v ) { registerForContextMenu( v ); openContextMenu( v ); } }; How can I call registerForContextMenu( v ); openContextMenu( v ); from inside my regular menu handler here: public boolean onOptionsItemSelected( MenuItem item ) { switch( item.getItemId() ) { case OPTIONS: registerForContextMenu( v ); openContextMenu( v ); return true; where I have no View to pass?

    Read the article

  • Can't run the ActionBarCompat sample

    - by David Miler
    I am having trouble compiling and running the ActionBarCompat sample of Android 16. I have API level 16 as the build target selected, which seems to build fine, but when I try to debug these errors pop up. Of course I could change the min API level in the manifest, but what would be the point of that? I have made no changes to the sample, so how come it is not working properly? Class requires API level 14 (current min is 3): android.view.ActionProvider SimpleMenuItem.java /ActionBarCompat/src/com/example/android/actionbarcompat line 129 Android Lint Problem Class requires API level 14 (current min is 3): android.view.ActionProvider SimpleMenuItem.java /ActionBarCompat/src/com/example/android/actionbarcompat line 134 Android Lint Problem Class requires API level 14 (current min is 3): android.view.MenuItem.OnActionExpandListener SimpleMenuItem.java /ActionBarCompat/src/com/example/android/actionbarcompat line 155 Android Lint Problem I am thoroughly confused, any help would be appreciated.

    Read the article

  • Is it possible to start an activity from a regular java class?

    - by Yotam
    In my ActionBarSherlock I have the same menu items for all activities, so it seems unwise to define onClick handlers in each activity - they all do the same. Instead I created a class called MyClickListener that implements com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener, and in there I have a simple switch block that starts the appropriate activity. Problem is that Intent constructor's first argument is of type Context, and even when I pass this to MyClickListener's constructor, I can't start any activity. The same goes for every method that has a Context object as a parameter. Is there a way to work around it? What is a context object? Thanks

    Read the article

  • XUL: create menu items dynamically and set "selected" attr

    - by Michael
    I have a firefox extension Options pref panel, where I should dynamically create menu items and select particular item to be current. here is the XUL file part <menulist id="rss_service_combo"> <menupopup id="rss_service_menu"/> </menulist> Then in load event of the pref panel, using js I append menuitem elements into menupop. This is working fine. The only problem is that even if I set the selected element the item is not selected and combo box is initially empty. The only way is working at the moment is if I manually add those menuitems into XUL file and set selected attribute, but I need to do it dynamically.

    Read the article

  • finditem() doesn't find menu, stuck with NullPointerException

    - by fdansv
    I'm stuck while changing some properties on my options menu at onCreateOptionsMenu(). It seems like findItem() returns null, even though I'm pretty sure that the reference to the menu item is correct. My code looks as follows: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_profile, menu); MenuItem leftie = menu.findItem(R.id.menu_profile); leftie.setIcon(R.drawable.ic_menu_mapmode); leftie.setTitle(R.string.back_map); leftie.setIntent(authIntent); return true; } I really don't know what can be wrong there. Thanks in advance :) EDIT: I forgot to include the actual problem.

    Read the article

  • FireFox Toolbar Open Window in new Tab

    - by Mark
    Hi all, I have a Toolbarbutton <toolbarbutton context="TabMenue" id="esbTb_rss_reader" label="News" type="menu"> with a Context menue which comes up when the button is right clickt <menupopup id="TabMenue" > <menuitem label="New Tab" oncommand="esbTb_loadURLNewTab()"/> </menupopup> so this function should open the new window in a new tab function esbTb_loadURLNewTab() { window.open(ClickUrl,'name'); } I don't get it working that the new Window is showing up in a new tab it always opens a new firefox window. I tried also like described in this article to set the browser.link.open_newwindow and browser.link.open_newwindow.restriction preferences but that doesn't bringt anything. And I tried it with all Target attributes which came in my mind. So I'm grateful for any hints, tips what ever this is driving me crazy...

    Read the article

  • Silverlight Cream for May 06, 2010 -- #857

    - by Dave Campbell
    In this Issue: Alan Beasley, Josh Twist, Mike Snow(-2-, -3-), John Papa(-2-), David Kelley, and David Anson(-2-). Shoutout: John Papa posted a question: Do You Want be on Silverlight TV? From SilverlightCream.com: ListBox Styling (Part 3 - Additional Templates) in Expression Blend & Silverlight Alan Beasley has part 3 of his ListBox styling tutorial in Expression Blend up... another great tutorial and all the code. Securing Your Silverlight Applications Josh Twist has a nice long post up on Securing your Silverlight apps... definitions, services, various forms of authentication. Silverlight Tip of the Day #13 – Silverlight Mobile Development Mike Snow has Tip of the Day #13 up and is discussing creating Silverlight apps for WP7. Silverlight Tip of the Day #14 – Dynamically Loading a Control from a DLL on a Server Mike Snow's Tip #14 is step-by-step instructions for loading a UserControl from a DLL. Silverlight Tip of the Day #15 – Setting Default Browse in Visual Studio Mike Snow's Tip #15 is actually a Visual Studio tip -- how to set what browser your Silverlight app will launch in. Silverlight TV 24: eBay’s Silverlight 4 Simple Lister Application Here we are with Silverlight TV Thursday again! ... John Papa is interviewing Dave Wolf talking about the eBay Simple Lister app. Digitally Signing a XAP Silverlight John Papa has a post up about Digitally signing a Silverlight XAP. He actually is posting an excerpt from the Silverlight 4 Whitepaper he posted... and he has a link to the Whitepaper so we can all read the whole thing too! Hacking Silverlight Code Browser David Kelley has a very cool code browser up to keep track of all the snippets he uses... and we can too... this is a tremendous resource... thanks David! Simple workarounds for a visual problem when toggling a ContextMenu MenuItem's IsEnabled property directly David Anson dug into a ContextMenu problem reported by a couple readers and found a way to duplicate the problem plus a workaround while you're waiting for the next Toolkit drop. Upgraded my Windows Phone 7 Charting example to go with the April Developer Tools Refresh David Anson also has a post up describing his path from the previous WP7 code to the current upgrading his charting code. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13  | Next Page >