Android :: How To Capture Key Events With Window-less Activity?

Dec 2, 2009

I have an Activity which has no window (but it has a view). I'm using: getWindowManager().addView(view, params);I've attempted to call takeKeyEvents(true), however I see that takeKeyEvents first retrieves the Window and then calls takeKeyEvents on that Window.In my case, the Window is null.What this means is that I never receive onKeyUp and onKeyDown calls, which I need in order to intercept some key presses from external input devices (similar to a handsfree set for example).

Android :: how to capture key events with  window-less activity?


Android :: Capture Key Events While In Background

Dec 2, 2009

I am planning to port an application from Symbian to Android and I'm looking at the possibilities of the Android platform.

My application runs in background and needs to detect when the user presses and holds a button (for 3-4 seconds) on the phone even when the phones key lock is on.

I am in the process of learning Android programming but so far what I understand is that if my application runs as a service it would be able to receive broadcast such as ACTION_MEDIA_BUTTON. Am I looking in the right direction?

I had a quick look at the list of native android broadcast actions and I could only find broadcast actions for Camera, Media and Call buttons. What about the other buttons?

View 6 Replies View Related

Android :: Capture The Events For An Application?

May 19, 2010

I want to capture the events like user clicked on so and so button, or > entered some text in Edit Box and etc...

View 3 Replies View Related

Android : Way To Capture Soft Keyboard Key Events?

Oct 28, 2009

I am facing a problem any one can help me regarding this. I have an EditText and a list of contacts. I want to search a contacts on matching with characters entered in EditText field.

View 6 Replies View Related

Android : Way To Capture Soft Keyboard's Key Events?

Jul 2, 2009

I am popping an alert box whenever an user exceeds 100 characters in a text-box(EditTextPreference). Now i am able to capture the hard keyboard's, i.e. computers's keyboard, events, but i am not able to capture the sofkeyboard's key events. There are some keys like numbers, enter, delete etc. in the softkeyboard which i am able to capture using onKey, but i am not able to capture the alphabets and other keys. i also tried setOnKeyboardActionListener, but didnt get the desired results,( may be i was not using it correctly). Can any one suggest how to capture the click of alphabets on the sofkeyboard.

View 12 Replies View Related

Android :: How To Capture Key Events From Intent's / Broadcast Receivers?

Oct 29, 2010

Is there a way to capture a key event from the Menu button using an Intent or Broadcast Receiver? Basically I want my app's Service to be activated when the Menu key is pressed.

View 1 Replies View Related

Android :: Application That Has To Capture The Key Events Both In Foreground And In Background

Jul 26, 2010

I am developing an application that has to capture the key events both in foreground and in background. I used the following code. But am unable to capture the keys in background.

CODE:............

I used broadcast reciever..

CODE:.................

View 1 Replies View Related

Android : Capture - Suppress Home And EndCall Buttons Events?

Jan 4, 2010

If you ever tried to write a locker app on Android sure you meet this problem: Code...

Seems like onKeyDown is filtering out all keys but "Back" and "Menu". Well, it's not true! Home button will still bring you Home screen and End Call button will run native Locker application!

Fellow's out there also claim it as a problem: How to listen from ENDCALL button problem With Home Back screen button Suppressing Key presses in Activity, especially in Options Menu
Issue 4202: Feature Suggestion: permission for intercepting KEYCODE_CALL

Do you know any workaround to block two those buttons? Is the only way (as often) - write in C ?

View 2 Replies View Related

General :: Capture Stylus Hover Events Before Get To Apps

May 13, 2014

I'm trying to work with a custom build of Android based on KitKat to incorporate a stylus, copying some of the functionality (though not code) from Samsung which sells Android-with-stylus builds for e.g. the Note 3. I'm not including details of the specific device because right now I am working on a custom dev device and my aim is to write code which is generic enough to be usable from any Android (based on KitKat). The build (written by others) already incorporates drivers and sends stylus events correctly as motion events etc. Programming at the app level I can receive onHover, ontouch, onClick etc

The specific functionality I am trying to achieve is to pick up a stylus-button-click while hovering. It's perfectly possible to do this in any app, using an onGenericMotion Listener.

However, I want to make my "stylus-action" have system-wide effect - so that anywhere (in any other app, or in the launcher or whatever) I will pick up the event (prior to any other app) and bring up my custom menu. (just like AirCommand in Samsung Note 3) I guess in my custom Android this would then make that particular action somewhat protected or unusable for other users, but I'm ok with that.

In older Android (prior to ICS) you could try something by putting up a System Overlay (i.e in regular app code, without hacking the ROM at all), but this is no longer possible.

This is not an attempt to tapjack or whatever, I understand why this functionality has been removed from the domain of the regular programmer, and I don't want to regress my ROM back to pre-ICS behaviour by allowing the System Overlay hack. Now I am programming the system (if my change is good enough I'd like to submit it back to AOSP) so I would like to know the best method to address this. Since Samsung have already done this, it must be legal (using legal in the terms of "Android will allow it"), and I want to do it right.

Is it possible to write something similar to the System Overlay when you are running from a system service? Or is there a good choke-point to capture events before they are broadcast to the current running apps?

I was looking at AndroidXRef /frameworks/base/core/java/android/view/View.java specifically in the function dispatchHoverEvent() which looks like a promising place. My naive idea is that I would place code here checking the MotionEvent to see if the button is pressed and if it is, don't call any listeners and instead call my little menu app (or broadcast a custom message, or something anyway). However, I've never written code on the ROM level before (LOTS of experience writing app code) so I don't know if this is a really bad point or a good point to add in code. Should I be putting things at a higher level or a lower one? Will this capture all events or not? Is it all just trial and error?

View 4 Replies View Related

Android :: How To Capture Browser Activity Or Callback

Sep 14, 2009

My activity calls a browser activity where the users submits their info to retrieve a PIN. That PIN is then sent as a parameter to a url specified in the request.

View 4 Replies View Related

Android :: Activity Leaked Window

Oct 2, 2009

Is the 'Activity leaked window' issue (http://code.google.com/p/ beepmystuff/issues/detail?id=3) fixed in any of the latest Android releases? I'm not sure about the Android version I'm using. I get this error during orientation changes. I create PopupWindows inside TextView. When I change orientation when the popupwindow is shown, my log says Activity has leaked a window (popupwindow) and then sometimes the application crashes, but not always. When the application crashes, the log says 'Uncaught handler: thread main exiting due to uncaught exception java.lang.IllegalArgumentException: View not attached to window manager'

View 11 Replies View Related

Android :: Capture / Trap For Activity Not Found Exception

Mar 16, 2009

I am playing with "android.speech.action.RECOGNIZE_SPEECH" and in the source it says to trap for ActivityNotFoundException. However, I am not sure how I can do this, the activity class doesn't support this event. I found it as part of android.content, but am not sure how to implement it. Multiple inheritance?

View 2 Replies View Related

Android :: Image Capture Intent / Activity Not Get Called

Jun 26, 2009

I start an IMAGE_CAPTURE Intent like this, and my activity's onActivityResult() get called: Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null); i.putExtra("return-data", true);
startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);
But, if I start my Intent like this, the Capture Image Intent did get called, but my activity's onActivityResult() never get called:
Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null); i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file:/" + "MyTestFile")); i.putExtra("outputFormat", Bitmap.CompressFormat.PNG.name());
startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);

View 3 Replies View Related

Android :: Leaked Window In Preference Activity

Jan 30, 2009

I've created a set of preference screens building on the tuts on androidguys. My preference XML contains nested PreferenceScreens. The below doesn't occur in the root screen, only once clicking to a child PreferenceScreen. Once in that PreferenceScreen, even before selecting an EditPreference, if I change orientation (i.e. flick the G1 keyboard out) I get an error: 01-30 09:33:54.080: ERROR/WindowManager(1261): android.view.WindowLeaked: that was originally added here.I have previously overcome this in other activities by utilising the onPause etc methods with custom dialogs I use. How can I prevent this in the PreferenceActivity? What am I missing?

View 17 Replies View Related

Android :: Launch Activity From On-screen Camera / Capture Button?

Feb 8, 2010

Is it possible to start an activity from the built-in Camera app after the user touches the on-screen Capture button?

View 4 Replies View Related

Android :: Create Transparent Window Without Starting A New Activity?

Mar 19, 2009

I have a 2D app. When the user presses a button, I need to quickly open a translucent 3D animation and overlay that on top of the 2D app. This is similar to the "Translucent GLSurfaceView" demo in APIDemo.

However, with APIDemo on G1, it takes about 100~200ms for the new Activity to come up. For me, this is too long. Is there any way to make it faster (to about 30~60ms).

My idea is to create a transparent Window object that contains a SurfaceView and hide it. When user presses button, the Window is shown.

View 2 Replies View Related

Android :: Starting Activity Witouth Window From Widget

Apr 17, 2010

I recently (yesterday in fact :)) started creating widgets.

So my first widget I want to create is something like: * A 2x2 widget * Containing 2 buttons * Button

1: Register current time and location * Button

2: Open up an activity where configuration can be modified, registered times and location can be viewed,...

Now the problem for me is button 1. As I only try to do some registration data (so no further user input required after pressing the button) I would like to just show a loading bar and after wards Toast a message to screen, or a popup if anything goes wrong.

This is what I do now:

CODE:...........

So what happens: I click the button, a plain black screen pops up (Altough I did not specify a layout upon creating the activity), and after my work is done the Toast shows up and the activity gets 'killed'. Basically that is what I want to do except for the black screen to show up. Is it possible not to show a screen upon creating the activity?

View 2 Replies View Related

Android :: ActivityGroup - Embedded Activity Search Window

May 27, 2009

I have an ActivityGroup with an embedded TabActivity and another simple Activity.

The TabActivity has three tabs, each one with a ListActivity.

When I try to start a search from a list (calling onSearchRequested()), I get a WindowManager$BadTokenException.

I've tried requesting focus in the list, but the same error occurred.

View 4 Replies View Related

Android :: Progress Dialog Unable To Add Window In Preference Activity

Jun 17, 2010

I encounter a problem with a ProgressDialog in a PreferencesActivity in my application.What I want to do is pop up a ProgressDialog after the user has changed his username or password during the check on the remote server. In the onSharedPreferenceChanged() I call the ProgressDialog.show() method. Sometimes it works fine, sometimes not at all.

View 2 Replies View Related

Android : How Can I Get A Dialog Style Activity Window To Fill Screen?

Sep 1, 2009

I am using an activity with the dialog theme set, and I want it to be full screen. I tried all sorts of things, even going through the WindowManager to expand the window to full width and height manually, but nothing works. Apparently, a dialog window (or an activity with the dialog theme) will only expand according to its contents, but even that doesn't always work. For instance, I show a progress bar circle which has width and height set to FILL_PARENT (so does its layout container), but still, the dialog wraps around the much smaller progress bar instead of filling the screen. There must be a way of displaying something small inside a dialog window but have it expand to full screen size without its content resizing as well?

View 2 Replies View Related

Android :: Activity Events On StartActivity

Sep 28, 2010

Is there any event triggered on an activity when I call startActivity("activity_id", myIntent);

If the Activity exists already. I pass a parameter to the activity via i.putExtra("someID", someSerializableObject ); and would like to call a method to refresh a WebView. Right now, the call on startActivity brings the activity in the foreground but the webview does not display what i want.

View 1 Replies View Related

Android : Way To Handl Key Events In A Paused Activity?

May 4, 2009

A main task and a secondary task - the secondary task has only one Activity - when that Activity is paused (e.g. Home key pressed), a notification is inserted to the Notification Bar, so that the user can go back to it (such as voice call does) My problem is: I need the paused Activity to receive key events. 1) Is that possible? 2) If so, how? (I have already tried setting "takeKeyEvents(true)", but whenever I press a key, the "Bookmarks" activity comes to the foreground)..

View 17 Replies View Related

Android : Send Touch Events To Foreground Activity

Jul 21, 2010

I'm trying to figure out a way to send touch events to the foreground activity. Essentially I want to write something that allows me to run it from the shell and just say "I touched this co-ordinate", so that I can automate some UI tasks for testing. Essentially what Monkey does, but application agnostic.

I think that android.view.MotionEvent holds the key, but I'm not sure how to run something without view so that I don't interfere with what is on the screen. Perhaps with a service, but I'm unclear how that would work.

View 5 Replies View Related

Android :: Implement Touch Events On Activity And Button On Droid?

Apr 23, 2010

I have an Android activity with an ImageButton. I would like to execute some logic when the button is clicked and show a different image for the pressed state, but also receive the touch event on the activity.

By default only the button receives the touch event. If I set the clickable attribute of the button to false then only the activity receives the touch event.

What's the best way to implement the touch event in the activity and the click in the button?

View 2 Replies View Related

Android :: Downloader Activity - After Downloader Has Completed Window Disappears And Nothing Happens

Jan 1, 2010

I have integrated the downloader activity (Google provided) into my application.. On the whole a very straight forward process. A problem I have though, is, after the downloader has completed the window disappears and nothing happens. If I hold down the HOME key I see my app and if I click on it my appss window comes up and runs correctly. Also when I run it subsequently it works correctly. Has anyone else experienced this? It certainly looks like the downloader should trigger my app when it is done; I am not sure if the window is just not getting focus or someething. It is a fullscreen GL app.

View 2 Replies View Related

Android :: Difference Between Phone Window And Mid Window

Sep 1, 2010

What is the basic difference between the PhoneWindow and MidWindow policies? I found that the emulator version takes the implementations of the PhoneWindow.When the MidWindow implementations will be used? Also, I found that PhoneWindow handles the call settings implementation and the same is not there in MidWindow? Please someone help me pointing out the differences between both the policies and under which circumstances which one will be used.

View 6 Replies View Related

Android :: What Window.demo.clickOnAndroid() - Window And Demo?

Feb 7, 2010

<html>
<script language="javascript">
/* This function is invoked by the activity */
function wave() {
alert("1");
document.getElementById("droid").src="android_waving.png";
alert("2");
}
</script>
<body>
<!-- Calls into the javascript interface for the activity -->
<a onClick="window.demo.clickOnAndroid()"><div style="width:80px;
margin:0px auto;
padding:10px;
text-align:center;
border:2px solid #202020;" >
<img id="droid" src="android_normal.png"/><br>
Click me!
</div></a>
</body>
</html>

What is "window.demo.clickOnAndroid()"? I know that clickOnAndroid is a method in my Android application. But what is window and demo? My file is called demo.html. Is that it?

View 2 Replies View Related

Android :: How To Capture Any Screen?

Sep 7, 2009

I want to use screenshot kind of application in my own application. So that I can take picture in any format and save it. There is one function getDrawingCache() which does that, but it only save picture what is available on the screen. It does not capture beyond screen if the picture is big.

View 2 Replies View Related

Android :: Signature Capture App?

May 21, 2010

i had an interview this morning for a job, and have an opportunity to earna great deal of brownie points with the business owners.They were thinking of purchasing some sort of electronic signature capture device (like fedex or UPS has when you sign for a package) for invoices.. BUT.I also mentioned my Droid Eris and how it can do so much. Turns out, both of the Owners have DROIDs lol.Anyways.. I want to know if anyone has seen some sort of application that can capture signatures, and either save an image to be emailed, or email directly from the app.OR does anyone know a DEV that could create something as simple as this, that I can talk to and relay updates on the APP to the owners of this company.They seemed really interested in it, and I'm pretty positive it will show a good bit of initiative in saving their company money from the get-go (on my part)

View 10 Replies View Related

Android :: How To Capture Video?

Jun 23, 2009

I would like to create a video recorder and so far haven't figured out how to set parameters in order to successfully go through MediaRecorder.prepare() method. Executing the following method

public void start() throws IOException{
String state = android.os.Environment.getExternalStorageState();
if(!state.equals(Environment.MEDIA_MOUNTED))
{
throw new IOException("SD card is not mounted. It is " + state + ".");
}
File directory = new File(path).getParentFile();
if(!directory.exists() && !directory.mkdirs())
{
throw new IOException("Path to file could not be created.");
}

recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
recorder.setVideoFrameRate(15);
recorder.setVideoSize(176, 144);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
this.state = VideoRecorderState.STATE_RECORDING;
}

it throws an exception on line recorder.prepare(). Does anyone know how to set parameters in order to be able to capture video?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved