android

Showing additional object for a second in android

I want to display a text for two seconds that tells the user that he has made a mistake. I want the behavior of an popup behavior of an AlertDialog. However the alert should close automatically after two seconds and accept no on screen clicks that close it. What class should I use? ...

ZXing doesn't read 1D barcode in Android app

I am developing a new application which hopefully will use a barcode reader to scan and find books. I will then use the ISBN information to get more information. The intents work and I can scan 2d barcodes ok but not the 1d barcodes of books which I know scan fine using the full application. This is my code. I have tried it without pu...

Android inflating xml layout generates RuntimeException

I'm new to Android and i'm trying to inflate a layout in xml but i get a RuntimeException. I have cut out almost everything except for my activity class and the class extending SurfaceView. Can anyone tell me what i'm doing wrong? main.xml: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/ap...

Android: Returning data from dialog

How i can return String value from onClick method? public class DialogWithInputBox extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); se...

Shortcut on the home screen to an action in my app

In my app I have a ListView when user click on an item some action is performed. Now I want to make a context menu for list item with possibility to add this action to home screen as a shortcut. Could somebody offer me some link or a hint how to do this? ...

Android contacts api

I want to query commondatakinds.photo.photo for a specific contact id .. how should I put this? ...

Question about activity lifecycle: onNewIntent / onSaveInstanceState

I have ActivityLanding which calls an activity called ActivityFolder. In the intent I used putExtra("folderId", "...") (I know folderId is not the best example) I can store that to a variable and use it just fine but if eventually my activity gets killed to save memory I may lose the folderId. When my activity gets launched again,, will...

Adding to Androids GridView Example

Hi there, was wondering if anyone could help me on how to add a type of 'popup' to Googles Androids GridView example. Found at.. http://developer.android.com/resources/tutorials/views/hello-gridview.html at the moment I only managed to work out how to set the clicked imaged as a background. How could I have it popup as a View or someth...

Android: Service restart after preferences change

Hello, I have a Service and a PreferenceActivity that allows the user to edit some preferences. I would like to restart the Service once the user is done with the PreferenceActivity. I understand that I can register onChange listeners for individual preference changes, but I do not want to restart the Service as each preference change...

Problem with Pick intent and track list

Hi, I'm very new to Android development and am trying to do something fairly simple, select from a picklist of tracks. I have some code that in theory works, and this is as follows; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setType("vnd.android.cursor.dir/track"); this.startActivity(intent); This works perfectly on the ...

How to force Admob to refresh on Android

I have an app with Admob ads on it but I find that when I use it the ad almost never refreshes because I don't change activities, instead I just update a text view when buttons are pressed. I have tried searching this on Google but keep comming up short. I would like to tell the app to refresh the add occasionally, such as after two bu...

Difference between 2 URI

I'm trying to save attachment (mms and GMail) Uri uri; uri = Uri.parse("content://mms/part/" + mmsPartId); uri = Uri.parse("content://gmail-ls/messages/[email protected]/messageId/attachments/0.1/BEST/true"); InputStream inputStream = getContentResolver().openInputStream(uri); openInputStream works fine for mms, but for GMail i got ...

How do I temporarily disable/bypass the Android OnTouchEvent

I'm currently using the event @Override public boolean onTouchEvent(MotionEvent ev) { To provide feedback from the user for game I'm writing. This event fires off some game control events that take some time to complete (because there is animation involved). The problem I'm having is during the animation if I keep touching the scree...

Centering a background image in Android

I have a background image about 100 x 100 that I want to center in an Android app. Is there a way to do this? I'm thinking it would greatly help with orientation changes for simple apps. ...

Handling gzipped content on Android

Hello, I'm trying to parse this file on Android using the DOM method. The code in question is: try { URL url = new URL("https://www.beatport.com/en-US/xml/content/home/detail/1/welcome_to_beatport"); InputSource is = new InputSource(url.openStream()); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); ...

Sending information with Intent.putExtra

Hello! I have an array of integers in the activity A: int array[] = {1,2,3}; And i want to send that variable to the activity B, so i create a new intent and use the putExtra method: Intent i = new Intent(A.this, B.class); i.putExtra("numbers", array); startActivity(i); In the activity B i get the info: Bundle extras = getIntent(...

Datepicker problem by using Java code but no problems if using XML parsing

Hello all, It is so strange that there is problem when I implement the same Datepicker method on Java code not XML. XML CODE approach: public class DateActivity extends Activity implements OnClickListener { private static final int DATE_ID=0; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInst...

android random number problem

Tried to create a random method that would query the database, obtain the number of rows in the database, and then grab a random number between 1 and the total number of rows to fetch a specific item in the database. It works alright, but not great, if there are less than ten entries in the database it will repeat the same entry about 4...

ImageButton showing artifacts in transparent image

Hello, I have a layout like this: <LinearLayout android:background="mybackgroundimage.jpg"> ... <LinearLayout android:weight=1> <!-- another layout to group the images below and give it weight=1 --> <ImageButton android:background="item1bg.png" .../> <ImageButton android:background="item2bg.png" ...

Selecting a Tab activity two ways

My app has three tabs, A, B, C that have three distinct activities. Tab A includes a list view. User can either select Tab B or scroll the list view in A, selecting a row will take him to Tab B with the position of the selected row. How can I detect in Tab B that the user has selected a row or clicked on Tab B. Clicking on Tab B sele...