I have setup 2 test contacts in my emulator.
I'm running the following query, it should pick them both out, populate my domain object, and add to a list. The output at the bottom should therefore be 2, but it is 5, why is this? (cursor.getCount() is 5 instead of 2)
I have stepped through each iteration of the while loop and it is retre...
Hello, I have some code in the onCreate method an Activity and noticed that it is being called three times. Is it normal behaviour? Thanks.
...
I have a ListView and would like to remove a row item when the user long clicks on selects Remove from the context menu.
@Override
public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Selection Options");
...
Why aren't menus inflated automatically for you in Android, the way an Activity's layout is?
...
There are posts all over the internet about how to hide the address bar in a WebView, but by default the WebView activity does hide the address bar. I'm interested in actually showing the address bar on a WebView inside my own Activity. However, I don't want to pop out to the default browser, because I am using my own WebViewClient which...
I have list of items ion my activity which I load dynamically, item after item.
Initially I load "lightweight" version and when processing is done I want to update the item with new information. Like set some text or replace an image.
That means I need to update what ListView item is displaying after Adapter#getView already returns. Of ...
Anytime I try to serialize a file I get the error: FileNotFound. Not sure why. Here is my FileHelper code:
package org.stocktwits.helper;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import jav...
I am having a couple problems with the code from the tutorial: ListView Tutorial. The code snipets giving me problems are:
static final String[] COUNTRIES = new String[] {
and
Toast.makeText(getApplicationContext(), ((View) view).getText(),
The errors read the following respectively:
Illegal modifier for parameter COUNTRIES; onl...
Hi,
I use this code for connection to my service, but when I put this line
this.bindService(service, conn, flags);
I receive error message: syntax error on token "}", { expected after this token ... (1)
here is all code in my class:
package com.flaxa.fixx;
import android.app.Activity;
import android.content.ComponentName;
import...
I have a dynamic tablelayout that I build programmatically. Every so often one of the rows has a child SeekBar.
Any suggestions for how I can programmatically make these SeekBars span across all the table columns?
Thanks.
...
Is it possible to have broadcastReceiver running inside a thread (just broadcastReceiver)? As far as I know, this can't be done unless there is a way to keep the thread alive (even tough there is no work). Please correct me if I'm wrong.
This is what I want to do: I have a client and a server program that run without knowing when anyone...
In my onItemClick method I have:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Uri formula = ContentUris.withAppendedId(Formulas.CONTENT_URI, id);
Cursor formulaCursor = managedQuery(formula, PROJECTION, null, null, null);
formulaCursor.moveToFirst();
searchBar.setText(formulaCursor...
I have a zoomable/scrollable image that is of high quality. When i zoom out, the image looks way too sharp. Is there a way to blur the image out a bit so i can code it to blur when it reaches a certain zoom level or is there a better way to go about this? For now i actually have a lower res version of my image that loads when the user hi...
Hi,
I am having problem with a GridView within a RelativeLayout, which is again within a ScrollView. The problem is that the height of the RelativeLayout is not following the height of the contents of the GridView. When there are more than one rows, the GridView is clipped and a scrollbar appears, which is undesirable. I have tried to i...
My ultimate goal is to limit records that are able to be created so that I can have a trial version of my application. I'm thinking I can do this rather simply by returning an int variable within a sqlite count statement, and using a simple IF statement to determine if a new record should be created.
I call like so:
int jcount = 0;
...
I am having an issue where occasionally the MediaPlayer.create method will return null, even though the audio file is definitely there. In fact, if I put the call to create into a while loop, the media player will eventually be created successfully. This only seems to happen on my phone (HTC Hero running 2.1) and never in the emulator.
...
I am implementing a context menu for my main activity. I have some XML to define the items:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:title="@string/random_item"
android:id="@+id/random_item"
android:icon="@drawable/random"/>
<item
android:title="@string/about_item"
android:id="@+id/about_...
Could someone maybe tell me what i'm doing wrong? I'm betting im missing one small thing. I've looked on the developer site and i've read some tutorials and i'm just not seeing what i did wrong.
I'm trying to use a ListPreference to decide which sound to play on a button click.
I have this at the top:
public String greensound;
Here'...
My Activity needs to monitor the orientation of the device. Now this works great with onConfigurationChanged(), but I also need to know orientation when my Activity starts.
So how do find out the current orientation of the device in my onCreate(), for instance?
...
Okay well I'm trying to make a Live Wallapper but whenever I click on settings it force closes. Saying the activity is not found which doesn't make any sense because, I have it in the Manifest. This is really starting to bug me as I've been at it for over 2 hours.
Logcat:08-28 01:06:49.903: INFO/ActivityManager(1089): Starting activity:...