android

Positioning an imageview inside a FrameLayout with layout?! (changing ImageResource)

I have an ImageView with absolute size and position (in the FrameLayout): @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); layout((int)left, (int)(bottom-width), (int)(left+width), (int)bottom); } now when I change my ImageResource with: setImageResource(...); the position of all Images is set to top l...

Android game thread lifecycle implementation

Hello SO, So I am working on a new basic 2d game for Android and was setting up my usual implementation of a game thread working with a SurfaceView. While typing away, I realized that, while this seems to work, I would really like to know if there is a better way to achieve the same results. Here are the basics of what I do right now (I...

Android: Detect if a View's parent Activity is paused

In one of my Activities I have a ListView that displays a list of locations. For each list item I want a little arrow icon that points in the direction of the corresponding location. I implemented this icon by extending ImageView. This custom View has a listener that reacts to changes of the device's orientation by rotating the icon imag...

Android: Detect softkeyboard open

When the soft keyboard opens I want a scroll view to scroll down to the bottom. For this I can use: fullScroll(View.FOCUS_DOWN); But how do I fire that command after the soft keyboard opening event triggers? ...

How much text can fit into a string.xml file?

Android: I am programming an app that is beginning to use a massive amount of text. I'm putting all of my text in a string file and calling it from there and then placing portions of it into a textview. Is there a limit to that or is there a better way to store text (in a file or database?) and then retrieve it to go into a textview and...

AlertDialog.Builder: No items for checkboxes are shown

Hi, I have a problem with the alertdialog.builder in the following code: public void showSettingsBox(){ final CharSequence[] items = {"Item1", "Item2", "Item3"}; final boolean checked[] = new boolean[]{false,false,false}; AlertDialog.Builder builder = new AlertDialog.Builder(fLabyrinthGame); builder.setMessage(fMessage) ...

Landscape layout res folder for the Backflip and small screens?

I have a widget that works great across all phones except the Motorola Backflip. The problem occurs with my layout in landscape mode where some of my graphics are cut off. It looks like this is because of the screen size of the backflip is smaller than the normal android phone. I do not want to upset all my regular users by shrinking ...

How do you store XML data in a java object from a SAX parser?

I have created a class with 3 sub classes in Java. The 3 sub classes contain variables to store information from my XML document. I am able to store in the first two for there are only single instances of the data in the XML. The third class contains variables that repeat multiple times. I want to store an object of "third class" obj...

android.view.GestureDetector.OnGestureListener onFling() vs onScroll()

What is the difference of events of onFling() and onScroll() of android.view.GestureDetector.OnGestureListener? link text ...

Android: notifyDataSetChanged() not updating listview after orientation change

Hello all, I have a semi-complicated problem and hoping that someone here will be able to help me. On a click event I create a thread and start a long-running operation based on this method. After the long-running task is completed, it does a callback to another method, which does a post to the handler: @Override public void content...

Android: onSizeChanged, an example?

I want to use onSizeChange to detect the height difference in a LinearLayout when the soft keyboard comes on screen. I want to issue fullScroll(View.FOCUS_DOWN); at that point. An example would be greatly appreciated. ...

Android expandablelistview group/parent background image change when collapse or expand

I try to swap expandablelistview group background image when it is collapse or expand. But the background image was not correctly swap. For example when I expand the first group, background of second or third group get swapped. I am using RelativeLayout (group layout) and SimpleExpandableListAdapter (adapter). Here is what I did: // Cr...

ImageButton on Expandablelistview child item

Is it possible to have a clickable ImageButton on Expandablelistview child item? If yes, how to program its event listener? ...

How to copy plain text from a website and display it in a widget on android ?

Hi everyone, I need some help to make a widget that basically when clicked it access the internet and copy text from a single website link and display it in the widget? and guidance on how to do that or even better a simple example? I did finalized the widget so I just need the part where I grab the text from the website. Thanks a lot...

LauncherActivity usage

Could you please explain me purpose and usage of LauncherActivity? Documentation says that it "Displays a list of all activities which can be performed for a given intent". I understood that it should automatically build list of all activities found in application and provide their launching. Am I right? And how to use it? I have found ...

Open a Custom Dialog when clicking on a listview entry

I would like to open a custom dialog when someone clicks on a listview entry. That dialog will need to know the text that was clicked on in order to display additional information on that particular entry. Can anyone point me in the right direction on how to accomplish that? Thanks! ...

Android Eliminate Complete Action Using dialog

I have 2 apps and both integrate a package containing an activity. My problem is that when I launch any one app, and when it calls the activity inside the package, it shows me a dialog: Complete action using: App1 App2 I want to eliminate this dialog, so it just launches the activity from its own integrated package. Currently, my A...

result is disappeared when mobile orientation is changed

Hi, in my application result displayed in Text view is disappeared when mobile orientation is changed,for this what can i do.i want my application in both modes means portrait and landscape.for this what can i do.Give me some suggestions.Thanks in advance ...

[Android]how to run a sync process which updates with Google Contacts?

when i deal with deleting a contact using new google api,i got the problem here is my problem Following is the only response : You have to run a sync process, so it updates with Google Contacts, than it will be removed permanently. Check for deleted flag so what should i do to run a sync process which updates with Google Contacts? ...

How to start programming simple applications ?

i'm beginner, i've installed android sdk n eclipse also... i've written code for temperature conversion i.e from Fahrenheit to Celsius but when i run on emulator the calculation part is not working i.e no error in code part n i think its not accepting the input values.... please help me ...