Search Results

Search found 19183 results on 768 pages for 'android menu'.

Page 84/768 | < Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >

  • Show Alertdialog and use vibrator

    - by user1007522
    I'm having a class that implements RecognitionListener like this: public class listener implements RecognitionListener I wanted to show a alertdialog and use the vibrator but this isn't possible because I need to provide a context what I don't have. My alertdialog code was like this: new AlertDialog.Builder(this) .setTitle("dd") .setMessage("aa") .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }) .show(); But the AlertDialog.Builder(this) wants a context, the same problem with my vibrator code: v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); The getSystemService method isn't available. My code that starts the class: sr = SpeechRecognizer.createSpeechRecognizer(this); sr.setRecognitionListener(new listener()); Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"voice.recognition.test"); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,5); sr.startListening(intent); Whats the best way to solve this?

    Read the article

  • Clickable TextView in Android

    - by Cris
    i'm building an Android App that has many many TextView that i want to be clickable. I've tried to assign to the single TextView the properties android:clickable="true" and android:onClick="clickHandler" and when the app fires the clickHandler(View v) i correctly get, through the v.getId(), the clicked item. What i don't like is to define, for every TextView, the properties android:clickable and android:onClick ... is there something that i can do by code to say: "all the textviews are clickable and click is handled in 'clickHandler' ?" Thanks and greetings c

    Read the article

  • I try to change activity to next page, but it can't.

    - by Daisy
    I try to change page on android application. It have error but look like its swap a little while. public class gps_gui extends Activity implements View.OnClickListener{ /** Called when the activity is first created. */ private static final int ACTIVITY_CREATE = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button login = (Button) findViewById(R.id.login); login.setOnClickListener((OnClickListener) this); } public void onClick(View v){ //Toast.makeText(this, "Already Login",Toast.LENGTH_SHORT).show(); Intent i = new Intent(this, SecondPage.class); startActivityForResult(i, ACTIVITY_CREATE); } } public class SecondPage extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.second_page); } } In AndriodManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="gps.GUI" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".gps_gui" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="second_page"></activity> </application> <uses-sdk android:minSdkVersion="8" /> </manifest> Anyone can help me ? thanks Errors: 01-29 13:56:57.709: ERROR/AndroidRuntime(393): FATAL EXCEPTION: main 01-29 13:56:57.709: ERROR/AndroidRuntime(393): android.content.ActivityNotFoundException: Unable to find explicit activity class {gps.GUI/gps.GUI.SecondPage}; have you declared this activity in your AndroidManifest.xml? 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.app.Activity.startActivityForResult(Activity.java:2817) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at gps.GUI.gps_gui$1.onClick(gps_gui.java:30) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.view.View.performClick(View.java:2408) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.view.View$PerformClick.run(View.java:8816) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.os.Handler.handleCallback(Handler.java:587) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.os.Handler.dispatchMessage(Handler.java:92) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.os.Looper.loop(Looper.java:123) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at android.app.ActivityThread.main(ActivityThread.java:4627) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at java.lang.reflect.Method.invokeNative(Native Method) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at java.lang.reflect.Method.invoke(Method.java:521) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 01-29 13:56:57.709: ERROR/AndroidRuntime(393): at dalvik.system.NativeStart.main(Native Method)

    Read the article

  • I can not get the text from a selected item in a listview...pleeeeasss help.

    - by Miguel
    I always get an ClassCastException error... i do not what else to do... - I'm using a data biding concept to populated the listview from a sqlite3 database. - I just want to get the selected item text after a long press click. This is the code of the activity: public class ItemConsultaGastos extends ListActivity { private DataHelper dh ; TextView seleccion; private static String[] FROM = {DataHelper.MES, DataHelper.ANO}; private static int[] TO = {R.id.columnaMes, R.id.columnaAno }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.muestrafechas); this.dh = new DataHelper(this); Cursor cursor = dh.selectAllMeses(); startManagingCursor(cursor); this.mostrarFechas(cursor); ListView lv = getListView(); lv.setOnItemLongClickListener(new OnItemLongClickListener(){ @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1,int row, long arg3) { //here is where i got the classCastException. String[] tmp = (String[]) arg0.getItemAtPosition(row); //tmp[0] ist the Text of the first TextView displayed by the clicked ListItem Log.w("Gastos: ", "El texto: " + tmp[0].toString()); return true; } }); } private void mostrarFechas(Cursor cursor) { SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.muestrafechasitem,cursor, FROM, TO); setListAdapter(adapter); } } ///// This is the xml where a define the rows to show on the listview <TextView android:id="@+id/espacio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <TextView android:id="@+id/columnaAno" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" android:layout_toRightOf="@+id/espacio"/> <TextView android:id="@+id/separador1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" -- " android:layout_toRightOf="@+id/columnaAno" android:textSize="20sp" /> <TextView android:id="@+id/columnaMes" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@+id/separador1" android:textSize="20sp"/>

    Read the article

  • getView() in CountDownTimer's onTick return sometimes null

    - by HexWrench
    I had recently a crash report where I could see that in the CountDownTimer's onTick method the getView() call returns null. I use the onTick method to display the remaining time in a textView. The textView is inside a Fragment. Since the CountDownTimer runs in the UI thread I have no idea why this had happened. What could be the cause for this and what is a possible workaround for this problem? Thanks!

    Read the article

  • Optimal Activity Stack Order for a Main Menu button?

    - by kefs
    I'm developing an app that starts with a main menu, and then continues through three different steps (activities) to a final activity where the task is marked complete. On this last activity, i have several additional options (add note, share, etc..) and i also have a return to main menu button. My question is.. how do i stack the activities so that calling finish() on the final activity will return back to the first activity launched? i am currently just starting the new activity via an intent, so pressing back on this screen doesn't return me to home as i would like. Sorry in advance for being so convoluted in my desc

    Read the article

  • ActionBar SpinnerAdapter Large Branding followed by selection (spinner)

    - by SatanEnglish
    I'm trying to implement a spinner In the action bar that has brand Name above it. With the ActionBar setListNavigationCallbacks method if possible actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(mSpinnerAdapter, null); Can anyone give me an Idea of how to do this? I would put some code here but I have no idea where to begin as I have not managed to find relevant information yet. Edit: Using V4.0

    Read the article

  • ViewPager resize height to Content

    - by user1324936
    ViewPager does not wrap its height to its content. For my layout I need to set the hight then dynamically because it is nested in other layouts. Therefore I created a ScrollView as content of the ViewPager and check its height in onCreate method of the Fragment, but the ScrollView has always the same size. How can I resize the ViewPager to fit to its content? final ScrollView sv = (ScrollView) v.findViewById(R.id.sv); ViewTreeObserver vto = scrollViewMenuFragen.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { int height = sv.getMeasuredHeight(); //always same height independent of content height //need to resize ViewPager ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) mPager.getLayoutParams(); params.height = height; mPager.setLayoutParams(params); } });

    Read the article

  • Is it possible to dither a gradient drawable?

    - by Seu
    I'm using the following drawable: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:startColor="@color/content_background_gradient_start" android:endColor="@color/content_background_gradient_end" android:angle="270" /> </shape> The problem is that I get severe banding on hdpi devices (like the Nexus One and Droid) since the gradient goes from the top of the screen to the very bottom. According to http://idunnolol.com/android/drawables.html#shape_gradient there isn't a "dither" attribute for a gradient. Is there anything I can do to smooth the gradient?

    Read the article

  • Getting camera preview data without using a preview callback

    - by velocipedestrian
    I have an app that does some processing to camera preview frames before displaying them to the user. I'm currently using preview callbacks to access the image data, but the problem I have is that the onPreviewFrame() function stops getting called if you start recording video using a MediaRecorder, and I want the processing to continue when video is being recorded. I've tried doing the following: public static Bitmap convertViewToBitmap(View view) { Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),view.getHeight(), Bitmap.Config.ARGB_8888); view.draw(new Canvas(bitmap)); return bitmap; } to convert the preview surface to a bitmap, but when I pass the preview SurfaceView to the function it returns an all-black bitmap (it works when I test it on normal views though). Is there any other way I can access the image data if preview callbacks are not available?

    Read the article

  • how to pass a string to an already opened activity?

    - by Hossein Mansouri
    I have 3 Activities A1,A2,A3 A1 call A2 (A1 goes to stack) A2 call A3 (A2 also goes to stack) And A3 call A1 (A1 should call from stack not new instance...) I don't want to Create new instance of A1 just i want to call it from stack I want to send some Extra String to A1, the problem is here, when i send some String by using putExtra() to A1, A1 can not seen it! I put getIntent() in onResume() for A1 but it s not working... Code in A3 Intent in = new Intent(A3.this,A1.class); in.putExtra("ACTIVITY", "A3"); in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(in); Code in A1 @Override protected void onResume() { super.onResume(); if(getIntent().getExtras().getString("ACTIVITY")=="A3"){ new LoadAllMyOrders().execute(); }else{ new LoadAllMyshops().execute(); } }

    Read the article

  • When I debug my application I get frequently Launch error: Failed to connect to remote VM

    - by Pentium10
    When I debug my application I get frequently Launch error: Failed to connect to remote VM even If I try again it doesn't help, I need to restart Eclipse. Edit Not sure yet fully if the symptoms have to do with the fact that I get this error only when I launch Debug without a code modification. Whenever I do a modification to the source code and hit Debug it goes through, but if I don't it doesn't.

    Read the article

  • "No XML content. Please add a root view or layout to your document."

    - by ez4nick
    I am trying to follow this tutorial : http://developer.android.com/training/basics/firstapp/building-ui.html as I am new to android developing and this is what my "activity_main.xml" file looks like : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <EditText android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" /> When I click run I get an error that says "No XML content. Please add a root view or layout to your document." and I noticed there is a new file generated called "activity_main.out.xml". What could I be doing wrong?

    Read the article

  • How can I specify a dynamic height for an ImageView?

    - by kefs
    I have an ImageView at the top of my display that looks like the following: +----------------------------------------------+ ¦ ImageView +--------------+ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Actual image ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ +--------------+ ¦ +----------------------------------------------+ Below this, I have a series of Buttons and TextViews.. I would like the ImageView's height to dynamically increase depending on the max height of the screen. I'm aligning the layout containing the buttons along the bottom of edge of the screen, and I would like the rest of the screen taken up by the above ImageView. Also, since the ImageView contains a centered image, I would also like to set min height, and a scrollbar if the screen is too small to display the imageview and the buttons below. Thanks! Is this possible?

    Read the article

  • Persisting a context menu after screen rotation

    - by Macarse
    Hi. I have an activity that on it's onCreate method it does: registerForContextMenu(theView); and in onCreateContextMenu: super.onCreateContextMenu(menu, v, menuInfo); menu.add(blablabla); This works great, but the problem is that the context menu disappears when the screen rotates. How to fix this? Thanks for reading!

    Read the article

  • EGL initialized failed

    - by aquatear
    Hello Everybody, I used a SurfaceView and EGL to render my 3D contents. When I press BACK and return my activity, the activity's 3D objects become to white. The reason is when the original activity(3D activity) resume, EGL would initialize again. So EGL would initialize and destroy everytime when different activities switch. I am not sure if the problem is EGL initialize twice... but I did initialize and destroy EGL correctly. Anybody have this problem ? Have any solutions about this ?? Thank you so much

    Read the article

  • javascript pop-up menu help

    - by baiano
    I am working on a project similar to a table where the user will be able to add rows. Right now there is just one row type available but I would like to give the user the ability to select from a list without changing the layout of the page. So, I put together a menu that appears on mouseover of the 'add row' link and disappears on mouseout (with a slight delay and fade in/out) using mootools event listeners. It looks like: I am now trying to figure out an easy way to make it so that the list stays available when the user's mouse leaves the 'add a row' link to go to select an item from the list. I looked through various mootools add-ons and tutorial but didn't find anything all that helpful. Does anyone know of a good tutorial guide me through this or can otherwise point me in the right direction here?

    Read the article

  • share feature of menu in android application

    - by RBADS
    Hi, i asked so many question regarding my title but i could not get my proper answer till yet.I need to implement androd's menu feature in my application ie when we goes to gallery in android phone, when we press menu than it comes with lots of option like share...etc.My question is can i implement same menu feature in my application? It is possible or not? Thanks

    Read the article

  • Get application names with specific permission

    - by rolling.stones
    I want list of all applications installed on the device which use a specific permission like INTERNET. i am using this code , but not able to retrieve results , please help . private ArrayList<String> getInstalledApps(Context context) { ArrayList<String> results = new ArrayList<String>(); PackageManager packageManager = context.getPackageManager(); List<PackageInfo> applist = packageManager.getInstalledPackages(0); Iterator<PackageInfo> it = applist.iterator(); while (it.hasNext()) { PackageInfo pk = (PackageInfo) it.next(); if (PackageManager.PERMISSION_GRANTED == packageManager.checkPermission(Manifest.permission.INTERNET, pk.packageName)) results.add("" + pk.applicationInfo.loadLabel(packageManager)); } for (int i = 0; i <= results.size(); i++) { Log.v("app using internet = ", results.toString()); } return results; } Thanks in advance. Any help accepted :)

    Read the article

  • Is it possible to set font for entire Application?

    - by Samuh
    Hi, I need to use certain font for my entire application. I have .ttf file for the same. Is it possible to set this as default font, at application start up and then use it elsewhere in the application? When set, how do i use it in my layout XMLs? Sample code, tutorial that can help me here is appreciated. Thanks.

    Read the article

  • Change the background color of the options menu

    - by feragusper
    I'm trying to change the default color for the options menu which is white. I want a black background for every item on the options menu. I've tried some shoots like android:itemBackground="#000000" on the item element within the menu element but it doesn't work. I don't know if this is doable or not. Any idea would be welcome! :)

    Read the article

  • ListSelector applies to the entire list

    - by jax
    I have a simple list with a listselector like so. <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/round" android:listSelector="#99000000" android:clickable="true" android:cacheColorHint="#00000000" android:background="#00000000"> </ListView> As you can see android:listSelector="#99000000" but the "black alpha" color is applied to the entire list, not the selected item. So this is what I have now but the entire list still turns black ::listview_background.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_focused="true" android:drawable="@drawable/list_normal" /> <item android:state_pressed="true" android:drawable="@drawable/list_pressed" /> <item android:state_focused="true" android:drawable="@drawable/list_active" /> </selector> ::colors.xml <resources> <drawable name="list_normal">#96FFFFFF</drawable> <drawable name="list_active">#66000000</drawable> <drawable name="list_pressed">#CA000000</drawable> </resources> ::the xml tag in my list android:listSelector="@drawable/listview_background"

    Read the article

  • Adding group + items in Windows Explorer's pop-up menu?

    - by OverTheRainbow
    An application I use regularly is command-line based, and I would like to add the most used commands in the Windows Explorer's context menu that pops up when right-clicking on a file or folder. From what I read, a lot of programs in that menu are COM applications. Is there an easier way to add commands to the menu, as an alternative to opening a DOS box and typing commands? Ideally, it should work for XP, Vista, and 7.

    Read the article

  • Emulating Preference look/feel with LinearLayout

    - by colinodell
    I really like the look and feel of the Preference UI items and want to replicate that in my application. Basically I've got an Activity with a couple LinearLayouts set to be focusable. When they are focused, I want them to turn green (like Preferences do). Any idea how to apply that style to my LinearLayouts? Note: The LinearLayouts are essentially going to be clickable 'buttons' to launch a separate activity. They are NOT actual preferences or buttons, although they need to look/act similar to them.)

    Read the article

< Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >