Android :: Determine Image Area Clicked In Droid?
Jun 20, 2010Is there a way to determine in an Android app which area of an ImageView (x,y coordinates, for instance) was clicked by a user?
View 1 RepliesIs there a way to determine in an Android app which area of an ImageView (x,y coordinates, for instance) was clicked by a user?
View 1 RepliesA checkedTextView shows a text box and a checkbox.
Is it possible for code to determine if only the checkbox part was clicked?
If so, the code could respond differently the user clicking the checkbox or the text view.
In my class I have an OnTouchEvent and when a certain area is clicked, it will play a sound (Not sure if this is the best way to go about this?). However I have been running into bugs using the MediaPlayer. Sound will double play and then eventually sound will stop completely. I am wondering how to efficiently play 5 sounds. The user will be clicking the screen in different areas and different sounds will be playing. I have the attached code below but it only has the first area. Say I add in another area how would I go about changing the media player to play a different sound.
@Override public boolean onTouchEvent(MotionEvent e) {
x = e.getX(); y = e.getY();
if (x >= 232 && x<=287 && y>=117 && y<=157) {
//PLAY SOUND } return true;
Is there any way to determine when the user clicked the app icon to launch the app ? I mean say a user was using my app. Then he presses the home key as a result of which the app goes to the background. After sometime he clicks the app icon again. My question is do I get a call-back for this?
View 3 Replies View RelatedCreating a game in Android using multiple Buttons to display an image from the drawable folder. I want to change the button to a different image after the button has been clicked on.
Here is the button code:
CODE:.............
I can't find anything about how to change the actual image of the button. You can change the color of the button by using the following code in the java file: b36.setBackgroundColor(0xAA00AA00);
I am working on changing the image being shown when I have my ImageView Clicked. I am trying to use a similar code that I used for accomplishing this with a TextView but I can't seem to find the right terms to get it to work. Here is my current code:
electronconfiguration.setOnClickListener(new View.OnClickListener() {
public void onClick(View drawable) { if (drawable.equals(R.drawable.element_el))
electronconfiguration.setImageDrawable(R.drawable.aluminum_el);
else if (drawable.equals(R.drawable.aluminum_el))
electronconfiguration.setImageDrawable(R.drawable.element_el);
} } );
In my application I use an image . I made some portion of the image transparent. Now How can I find the co-ordinates of the transparent portion of the image so that I am able to find the actual area of the non-transparent area.. I want some methodical way to find.
View 1 Replies View Relatedright away I am doing an app for an festival, and I want to make a area map / area plan. I have got a picture (bigger then the screen) and I want to be able to move it up/down and to the left/right. Further I want to place smaler icons (like the stage, you should be able to click on it and see who is playing) or doing the same in de big picture and get the touch with a x/y request.but I haven't got an idea how I could realise this,
View 4 Replies View RelatedI am writing an android application that check the username and the password of the user once a login button is clicked
i run the app in the emulator and when i click on login button the application is crashed code...
I want to get the only one email-id from contact list on clicking the contact list NAME in android.
View 1 Replies View RelatedI have an imageview and when clicked, calls OnClickListener.onClick(View v). How do I get the exact point/coordinate that the user clicked?
View 1 Replies View RelatedI am trying to open up Gmail Compose screen when a button is clicked in my Android App.
Do I need some API key for this from Google? or what do I need to do in my button onClickListener?
The display area of my SGS has been reduced there is now a black line (approximatively 1 millimeter thick) around the display now anything that should be displayed has been centered (a kind of)i have noticed that after press-holding the HOME BUTTON (to get to the task manager).even when the phone that black border is still there and it look like the screen has been pushed down the display is not now at the same level as the top-cover (or screen cover).I have used the factory reset but nothing has changed.My phone look horrible now.
View 1 Replies View RelatedDoes anyone know if there is a way to identify (in code, not LogCat) when the GC has run? Perhaps an intent is fired? I could analyze the LogCat output, but it would be ideal if I could determine when the GC has run from my code.
View 2 Replies View RelatedI have an application where I would like to warn the user if they are not using the default Android softkeyboard. (i.e. they are using Swype or some thing else).
How can I check which input method they currently have selected?
I'm experimenting with Android's audio recording and playback. Is there a way to enumerate the available audio parameters on my device?
Right now, when I pass a combination of parameters that the hardware (or emulator) doesn't like, I just get an error. So I am having to "guess":code...
Surely there's a better way!
This chart indicates that the only supported audio input sampling rate is 8 kHz? Is that correct?
Is there a way I can find what resource a particular ImageButton is set to, at any given time?
For eg: I have an ImageButton that I set to R.drawable.btn_on onCreate. Later, at some point, the ImageButton gets set to R.drawable.btn_off. I want to be able to check what resource the ImageButton is set to in my code.
I have a layout that looks something like this:
[TextView 1] [TextView 2]
[ TextView 2 spill-over ]
Essentially, I need the contents of TextView 2 to wrap to the next line, but start where TextView 1 starts. I was thinking that if I knew how much text would fit into TextView 2 before it runs out of space on line one, I could take the rest of the text and put it in another TextView below the first two. So I need to measure how much text will fit into a TextView (which can be tricky because as far as I can tell, Android will try to break the text in a TextView at a good location so that it won't break a word in the middle if it can be avoided) or I need a new idea on how to lay this out.
How to distinguish Android is first run or not after booting device?
View 2 Replies View RelatedHow can I determine the current internet connection type available to an Android device? e.g. have it return WiFi, 3G, none.
View 2 Replies View RelatedIs there a way to determine what apps are currently installed on an android device? I guess reading /data/app directory doesn't do the trick (access denied).
View 1 Replies View RelatedWhat is the easiest way to find out how fast the Android device is traveling?
Also, is there a way to register an intent for speed? Example: intent if the device goes more than 20 miles an hour.
I know how to get the API level, android.os.Build.VERSION.SDK_INT, but there are also several revisions of each level release, e.g. for 2.1 there's rev 1 and 2. How do I determine the revision of a build?
The reason i'd like to know this is that I have a workaround for a bug in Android 2.1 (and 2.2), and this workaround will break the moment the corresponding bug is fixed. So right now i'm in the odd position of hoping that the bug won't be fixed (at least not until I can find an answer to above question).
Is there any way to determine programmatically the time at which an Android application was installed? I don't see anything in PackageInfo, etc.
--EDIT--
To clarify, App A is installed at Time X. At some later time, Time Y, App B is installed. Is there any way App B can know when App A was installed? The link http://stackoverflow.com/questions/2831333/how-to-get-app-install-time-from-android/2920310#2920310 indicates that reading the modify time on the source dir of the App is sufficient. Is this really correct? Why?
My dad has to measure a lot of acreage and area around fields. Anyone know of an app that you can use the DROID gps to do this? Such as start at a corner of a field, hit start and drive around the field and then measure it from the gps?
View 1 Replies View RelatedHow does Android determine whether to move the layout up when showing the softkeyboard?
Note: I am aware that the activity property android:windowSoftInputMode="adjustResize|adjustResize|adjustUnspecified"
exists, as described here http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
, but in my case it doesn't seem to have any effect. This is my problem:
I have two activities, pretty much the same layout, but the first one is using a ListView that holds a list of buttons. The second activity holds a scrollview with buttons.
The rest is the same, same number of buttons, same height of elements, etc.
Now, when I press the search button to open the search input bar, in my first activity, the entire layouts gets moved up.
While on the second activity, the layout is not being moved up but the softkeyboard just displays on top of it. This is actually how I want it to behave. How can I achieve the same with my activity that's using the ListView?
In my manifest, initially I didn't specify any android:windowSoftInputMode attribute, but even if I do, it doesn't make any difference; I tried all three values (adjustPan, adjustResize, adjustUndefined, without any difference).
This is my layout:
1) http://pastebin.com/5zzVxjbK
2) http://pastebin.com/KFtPuHvP
Interestingly though: when I set my ListView visibility in my layout 1 (left) to View.INVISIBLE, then the layout doesn not get moved up!
Is there a way through the android maps API, where I can detect the map center after pan animation has completed? I want to use this information to load markers from a server dynamically.
View 2 Replies View RelatedI'm trying to programmatically determine what audio applications are installed on an Android phone. I'm able to enumerate all the installed applications, but don't yet see a way to figure out which ones are capable of playing audio? What property of the application would have to queried to determine if is capable of playing audio?
View 1 Replies View RelatedOn the iPhone, safari strips out scrollbars on divs that have overflow set to auto or scroll, but still lets the user scroll with the two-finger swipe gesture.
Using an HTC Incredible, we see the scrollbars are again missing, but we cannot figure out any gesture that allows the user to scroll. Is there a special directive we need to add to our HTML? This should affect zillions of websites, any time someone is trying to scroll an area of the page rather than the whole page. Does anyone know how to enable scrolling a div using the web browser on Android phones?
I have designed a 3D model in .obj format and imported using min3d framework. Its a cube with different colors. I want to give a Toast with a message for a particular color when the side of that particular color is touched. How do I do this in android 1.6 ?
View 1 Replies View Related