Skip to main content

Posts

Showing posts from January 16, 2012

Using Phonegap Barcode Scanner on Iphone

I'm trying to add a barcode scanner to a JQM phonegap project for iOS. I have followed the instructions listed, although I'm not 100% sure if I did the first and last steps correctly. Copy the .h, .cpp and .mm files to the Plugins directory in your project. You may need to set the compile options for zxing-all-in-one.cc to turn off optimization. I directly copied the three files into the plugins folder in xcode. It isn't giving me any errors, but it also isn't working. I have no idea how to do compiler options in xcode, so I haven't done the last step. Currently my app still runs with no errors and running the scan function opens the camera with the ui for the barcode scanner up. The problem is that it doesn't seem to be either looking for or finding barcodes, it just stays up and does nothing (until you hit cancel, then it displays the cancelled message correctly). Anyone have any ideas what's wrong or where I should look?

Using Phonegap Barcode Scanner on Iphone

I'm trying to add a barcode scanner to a JQM phonegap project for iOS. I have followed the instructions listed, although I'm not 100% sure if I did the first and last steps correctly. Copy the .h, .cpp and .mm files to the Plugins directory in your project. You may need to set the compile options for zxing-all-in-one.cc to turn off optimization. I directly copied the three files into the plugins folder in xcode. It isn't giving me any errors, but it also isn't working. I have no idea how to do compiler options in xcode, so I haven't done the last step. Currently my app still runs with no errors and running the scan function opens the camera with the ui for the barcode scanner up. The problem is that it doesn't seem to be either looking for or finding barcodes, it just stays up and does nothing (until you hit cancel, then it displays the cancelled message correctly). Anyone have any ideas what's wrong or where I should look?

EXC_BAD_ACCESS when opening modal view

I'm having a problem with my iPhone App, I'm getting EXC_BAD_ACCESS, I had some memory leaks, but these are now fixed, so I'm not sure whats going on. I realise that I haven't provide a lot of information, but I really don't know whats happening. The initial screen opens up where I have a number of buttons. Tapping on the first button, which runs the following code and opens up a modal view: -(IBAction)newWorkoutButton { newWorkoutViewController .loadedFromRootViewController = @"YES"; [self presentModalViewController:newWorkoutViewController animated:YES]; } The screen freezes and the is in the code below: #import <UIKit/UIKit.h> #import <objc/runtime.h> #import <CoreLocation/CoreLocation.h> int main(int argc, char *argv[]) { Method getDistanceFrom = class_getInstanceMethod([CLLocation class], @selector(getDistanceFrom:)); class_addMethod([CLLocation class], @selector(distanceFromLocation:), method_getImplementation(

EXC_BAD_ACCESS when opening modal view

I'm having a problem with my iPhone App, I'm getting EXC_BAD_ACCESS, I had some memory leaks, but these are now fixed, so I'm not sure whats going on. I realise that I haven't provide a lot of information, but I really don't know whats happening. The initial screen opens up where I have a number of buttons. Tapping on the first button, which runs the following code and opens up a modal view: -(IBAction)newWorkoutButton { newWorkoutViewController .loadedFromRootViewController = @"YES"; [self presentModalViewController:newWorkoutViewController animated:YES]; } The screen freezes and the is in the code below: #import <UIKit/UIKit.h> #import <objc/runtime.h> #import <CoreLocation/CoreLocation.h> int main(int argc, char *argv[]) { Method getDistanceFrom = class_getInstanceMethod([CLLocation class], @selector(getDistanceFrom:)); class_addMethod([CLLocation class], @selector(distanceFromLocation:), method_getImplementation(

iPhone, iPad script rule out

Is it possible to rule out a script load only when viewing site on Apple devices? For example I don't want this file to be loaded on iPhone/iPad: <script type="text/javascript" src="js/jquery.skinned-select.js"></script> Will be grateful for any help.

iPhone, iPad script rule out

Is it possible to rule out a script load only when viewing site on Apple devices? For example I don't want this file to be loaded on iPhone/iPad: <script type="text/javascript" src="js/jquery.skinned-select.js"></script> Will be grateful for any help.

Page is not found by the Iphone simulator when using ajax /Jquery Mobile-PhoneGap

I am creating a webapp for iPhone using jQuery Mobile and PhoneGap. Everything works fine in Safari for Mac and Chrome for Windows. When I go to the iPhone Simulator the problems begin. Every button with a link to any page works fine except for one called "Article.html". The only way to open this page from the app is to turn off ajax by doing rel="external". I have done everything in order to get it work. I have deleted the file and brought it back via add -> existing file with not luck. The content of the page "Article.html" is very simple and I don't think that is the problem because it doesn't even load the page. The loading symbol stays there for ever. <!DOCTYPE html> <html> <head> <!--jquery and css files are being loaded in another page--> <title>This Date in History</title> </head> <body> <div data-role="page" class="type-interior" id=

Page is not found by the Iphone simulator when using ajax /Jquery Mobile-PhoneGap

I am creating a webapp for iPhone using jQuery Mobile and PhoneGap. Everything works fine in Safari for Mac and Chrome for Windows. When I go to the iPhone Simulator the problems begin. Every button with a link to any page works fine except for one called "Article.html". The only way to open this page from the app is to turn off ajax by doing rel="external". I have done everything in order to get it work. I have deleted the file and brought it back via add -> existing file with not luck. The content of the page "Article.html" is very simple and I don't think that is the problem because it doesn't even load the page. The loading symbol stays there for ever. <!DOCTYPE html> <html> <head> <!--jquery and css files are being loaded in another page--> <title>This Date in History</title> </head> <body> <div data-role="page" class="type-interior" id=

NSAutoreleasePool

Any idea why i get these messages - "NSAutoreleasePool is unavailable: not available in automatic reference counting mode" "ARC forbids explicit message send of 'release' " import int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; }

iPhone gcc-4.2 failed with exit code 1

Help, I'm at wits end -- sometimes my Xcode runs -- sometimes it doesn't I keep getting I installed Xcode 4.1 then upgraded to 4.2 I can't even run a freshly made project :( ProcessPCH /Users/david/Library/Developer/Xcode/DerivedData/iDecide-eurvfbqsagnsmkgdvuhytbalyxkj/Build/PrecompiledHeaders/iDecide-Prefix-fjnitkqizspbsgezzdhvfinujnhz/iDecide-Prefix.pch.pth iDecide/iDecide-Prefix.pch normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/david/Documents/tmp/iDecide setenv LANG en_US.US-ASCII setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/Users/david/.rvm/gems/ruby-1.9.2-p180/bin:/Users/david/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/david/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/david/.rvm/bin:/Users/david/apache-maven-3.0.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/usr/local/Cellar/android-sdk

How to properly update Three20?

I've just update my version of Xcode to 4.2 - Xcode has given me a load of warnings from the Three20 source. - So I guess the version of Three20 I have must not be compatible with iOS 5? I'm using the recommended shared directory layout but have manually downloaded the files from the zip, not using git. Once I have re-downloaded the files into the shared directory, should I do anything else to update my project - run the Three20 python script?

warning: UUID mismatch detected with the loaded library

i have been getting this since updated to 5.0.1 warning: UUID mismatch detected with the loaded library - on disk is: /Users/alfredjunco/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/Frameworks/CoreLocation.framework/CoreLocation i also got this one but i don't know if it matters unable to load symbol file: warning: Unable to read symbols for /Library/MobileSubstrate/MobileSubstrate.dylib (file not found). warning: No copy of MobileSubstrate.dylib found locally, reading from memory on remote device. This may slow down the debug session.

Anti-aliasing lines when using CATransform3DRotate

I copied the code from the answer to How do I apply a perspective transform to a UIView? in order to achieve the following image. Note, however, the jagged lines separating the levels. Is there away to perform this kind of perspective transformation in a way that anti-aliases these jagged lines? Edit I've tried the solutions offered by DarkDust in the comments on this post. None seem to work. Here's my code: levelView = [[UIControl alloc] initWithFrame:CGRectMake(100, 60, 160, 230)]; [self addSubview:levelView]; levelView.transform = CGAffineTransformScale(self.transform, .8, .8); CALayer *layer = levelView.layer; //DarkDust's 2nd comment layer.borderWidth = 1; layer.borderColor = [[UIColor clearColor] CGColor]; CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; rotationAndPerspectiveTransform.m34 = 1.0 / 1000; rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0f * M_PI /

&#39;UITabBarItem&#39; may not respond to &#39;SetAction&#39;

I have a number of tabs in my app. The tabs are working with no issues, but I'm getting some warning messages (in the title above) which I would like to get rid of. My code is as follows: -(void)pressItem1:(id)sender { [self presentModalViewController:settingsViewController animated:YES]; } -(void)pressItem2:(id)sender { [self presentModalViewController:infoViewController animated:YES]; } -(void)pressItem3:(id)sender { [self presentModalViewController:aboutViewController animated:YES]; } -(void)viewDidLoad { self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]]; CGRect frame = CGRectMake(0, 0, 480, 49); UIView *v = [[UIView alloc] initWithFrame:frame]; UIImage *i = [UIImage imageNamed:@"smallMenuBackground.png"]; UIColor *c = [[UIColor alloc] initWithPatternImage:i]; v.backgroundColor = c; [c release]; [mainTabBar insertSubview:v atIndex:0]; [v release];

Custom component&#39;s surfaceCreated never called

I am trying to create a custom component to have the camera's preview. The ctr is called, but surfaceCreated is never being called. Also, the xml graphical designer doesn't complain about anything not working with the custom component. CameraView: import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.Size; import android.util.AttributeSet; import android.util.Log; import android.view.Display; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; public class CameraView extends SurfaceView implements SurfaceHolder.Callback { private static

Can i sell ticket in an iphone app without IAP

I'm building a app for an online service that sell tickets on their website. We want to allow people to buy ticket from the iphone but we can't use in app purchase as it cost too much. So my question is, can we have a button on the Event detail view "View Tickets", then when clicked do on of the follow preferably the 1: Open a webview from the app that display the mobile optimized website. Open safari on the event detail screen. Thanks.

implicit conversion of an indirect pointer to an objective-c pointer with ARC

I'm Working on a project that uses ARC and I am having trouble with an existing piece of code that I already had. heres the code: - (id)initWithError:(NSError **)error { if ((self = [super init])) { errorPointer = error; //Getting error here } return self; } Im getting an error that says: implicit conversion of an indirect pointer to an objective-c pointer to 'NSError' is disallowed with ARC. What should I do to fix this problem? I've tried doing a bridged cast, but didn't work. Any help is appreciated. Oh and just for clarification, in the .h file this is how I declared the variable errorPointer: NSError *errorPointer; Thanks!

In iOS, Is GestureRecogizer target action running in a separate thread?

Here is the problem, on the UI of my iPhone app, I have a button and another imageView that accepts Touch gesture recognizer, both have target actions. If I touch the button and the view one at a time, everything is fine. But if I touch these 2 simultaneously, or in rapid succession, things get messed up. The button and gesture handler manipulate the same state variables, so if they run side by side, the result is non-deterministic. I tried to fix this problem by disabling the button the instant I get into gesture recognizer handler, and enabling it right before exiting the handler. But this doesn't solve my problem!!! So the only possibility (my guess) is that the gesture recognizer gets triggered when the button handler is running. But this could only happen if they resides in separate threads. So does anyone know if the gesture recognizer handler is running in a different thread? Or, more specific to my problem, what should I do in my situation? Use guard variables to prev

error in necessitas while use openCV libs

I'm programming in QT for android device and need to use openCV for capture from camera. I already used Qt creator and linked openCV and used camera, but in Qt for android (necessitas) when build program, show this errors: C:/OpenCV2.3.1/libs/armeabi-v7a/libopencv_highgui.a(cap_images.o): In function `CvCapture_Images::close()': cap_images.cpp:(.text._ZN16CvCapture_Images5closeEv+0x1c): undefined reference to `cvReleaseImage' C:/OpenCV2.3.1/libs/armeabi-v7a/libopencv_highgui.a(cap_images.o): In function `CvCapture_Images::grabFrame()': cap_images.cpp:(.text._ZN16CvCapture_Images9grabFrameEv+0x1e): undefined reference to `cvReleaseImage' C:/OpenCV2.3.1/libs/armeabi-v7a/libopencv_highgui.a(cap_ffmpeg.o): In function `CvCapture_FFMPEG_proxy::retrieveFrame(int)': cap_ffmpeg.cpp:(.text._ZN22CvCapture_FFMPEG_proxy13retrieveFrameEi[CvCapture_FFMPEG_proxy::retrieveFrame(int)]+0x50): undefined reference to `cvInitImageHeader' cap_ffmpeg.cpp:

how to fetch contact number in android?

I am trying to fetch contact number in my application but it is showing only id and display name can anyone correct it. I dont kno how to fetch the contact numbers. I am only trying to fetch the contact numbers not to add the contact numbers. package com.data; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ListView; import android.widget.SimpleCursorAdapter; public final class ContactManager extends Activity { public static final String TAG = "ContactManager"; private Button mAddAccountButton; private ListView mContactList; private boolean mShowInvisible; private CheckBox m

how to show up the voice recognition settings for in my app?

I am working on an android application in which i have implemented voice recognition and TTS. I have implemented TTS settings successfully by using following code: intent = new Intent(); intent.setAction("com.android.settings.TTS_SETTINGS"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(intent); Now I want to show system's "voice recognition settings" in my application to allow user to change language options etc. Please tell me how i can implement that.

How to add a text under the image button in Android?

I want to add text under a image button, which are also clickable, and will be redirected to the same activity as the image button. basically it's like the app list in any android phone, e.g.

Viewpager doesn&#39;t update/loads xml items

I solved the question with onclicklistsner issue with viewpager but now I noticed, that it depends on all Elements in XML Layout files. I implemented a ViewPager with that Tutorial: tutsplus Now I have the Problem, that all the Objects I defined in XML are instantiated correct (not null in Debuggin mode after findViewById etc) but I can't reffer to them. To understand it better here my PagerAdapter: class MyPagerAdapter extends PagerAdapter { public int getCount() { return 3; } public Object instantiateItem(View collection, int position) { LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0: resId = R.layout.settings_view; break; case 1: resId = R.layout.push_view; break; case 2: resId = R.layout.listen_view; break;

Android Bitmap Scale error

i have a bitmap(bk) and i need to scale it to my device screen. i try to do like this: bk1 = Bitmap.createScaledBitmap(bk, (int)(bk.getHeight()/height1*bk.getWidth()), height1, true); height1=device height and bk is the bitmap that i need to scale; when i try to debug i get the message Source not found. but the bk Bitmap isn't empty... My application force close when i run it. any1 can help me with this? i don't know what is the 4th parameter of the function but i get the error in any cases...

method called after release() exception unable to resume with android camera

while developing a camera app i'v encountered an exception that only happend when I switch to other intent (onPause for my app) or go to preference in my app(same, onPause) 01-15 17:22:15.017: E/AndroidRuntime(14336): FATAL EXCEPTION: main 01-15 17:22:15.017: E/AndroidRuntime(14336): java.lang.RuntimeException: Method called after release() 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.hardware.Camera.setPreviewDisplay(Native Method) 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.hardware.Camera.setPreviewDisplay(Camera.java:357) 01-15 17:22:15.017: E/AndroidRuntime(14336): at com.sora.cbir.yuki.image.leaf.CameraPreview.surfaceCreated(CameraPreview.java:32) 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.view.SurfaceView.updateWindow(SurfaceView.java:551) 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:213) 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.view.V

BroadcastReceiver not working on Android 3.0

I have a plugin framework which uses broadcast intents for communication between main application and plugins. On start main app sends a broadcast intent sendBroadcast(new Intent("com.mypackage.myapp.custom.intent.action.ADDON_REQ")); Each plugin app has a broadcast receiver registered in its manifest file. <receiver android:name="IncomingReceiver" android:enabled="true"> <intent-filter> <action android:name="com.mypackage.myapp.custom.intent.action.ADDON_REQ" > </action> </intent-filter> </receiver> Plugin application does not have any activities defined. This framework works fine on all Android versions lower that 3.0. Starting from Honeycomb the broadcast receiver in plugin is never called. I could not fix this until I added a main activity in the plugin app. With the activity defined in manifest existing broadcast receiver started to receive

How can I import java.awt.BufferedImage in an Android project?

I see answers to questions suggesting the use of BufferedImages for performing increases that I am very interested in. How can I avoid garbage collection delays in Java games? (Best Practices) But I cannot find out a way to import it because it is not part of the SDK of course. How has everyone else who have used it achieved this? I am basically looking for a way to store graphics I am writing on canvas without having to build them totally from stratch each time. For example storing a drawText() as a BufferedImage and drawing that each frame.

split action bar doesn&#39;t appear?

i want to make action bar top and down in android 4.03 make code but when i run it it doesn't appear , i don't know what is wrong , i search for reson before asking here but i didn't find anything here is menu/style.xml code: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/first" android:icon="@drawable/cat" /> <item android:id="@+id/first" android:icon="@drawable/phone" /> <item android:id="@+id/first" android:icon="@drawable/music" /> <item android:id="@+id/first" android:icon="@drawable/dialog" /> <item android:id="@+id/first" android:icon="@drawable/file" /> <item android:id="@+id/first" android:icon="@drawable/contact" /> <item android:id="@+id/first" android:icon="@drawabl

Empty intent extras in onActivityResult

I have two activities. First calls second like this: Intent intent = new Intent(this, Second.class); startActivityForResult(intent, 1); returning data in second one: Intent intent = new Intent(); intent.putExtra("a", "la-la-la"); setResult(RESULT_OK, intent); finish(); and trying to receive this data in first activity: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((resultCode == Activity.RESULT_OK) && (currentTask != null)) { //Here is empty intent extas!!! Log.d("OrderActivity", "RESULT!!"); } } So, request code and response code returned, but intent extra is empty..??

Best practice discussion: When to favor a webview over a native UI in titanium?

I'm currently working on a cross-platform mobile app and have gone through the process of creating the UI of my application using the given Titanium api. Compared to when you are building a mobile web application this is a time consuming task, because you don't have the possibility to work on the rendered UI like you can on a rendered webpage using firebug. Especially form creation is bothersome, so I decided to build my forms using html and render them in a Webview, which worked out pretty sweet for several reasons: WebViews are automatically scrollable, so the soft keyboard won't cover the input fields in your HTML form You can control which keyboard type is displayed with a WebView form by setting attributes on the <input> tag. You can use JavaScript libraries to add form validation, field highlighting, and so forth to an HTML form. Although this works like a charm and the titanium documentation encoura

How use WCF web services methods in Android

i have worked with wcf but i have problem with consuming wcf in android, could you just describe to me how you used ksoap2 for connect to wcf with android ublic SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request request.addProperty("GetSumOfTwoInts", "5"); //variable name, value. I got the variable name, from the wsdl file! SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //put all required data into a soap envelope envelope.setOutputSoapObject(request); //prepare request AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL); httpTransport.debug = true; //this is optional, use it if you don't want to use a packet sniffer to check what the sent message was (httpTransport.requestDump) httpTransport.call(SOAP_ACTION, envelope); //send request SoapObject

How to update listview whose data was queried from database through SimpleCursorAdapter?

I want to show the items queried from database in the listview with SimpleCursorAdapter. For example, there may be 20,000 items in the database. I want to just load 100 items(_id : 1-100) queried instead of load all items, when scrolling in the end of listview, load another 100 items(_id : 101-200) queried, how to achieve it? Any suggestion is welcome, thanks. Relative codes are as follows: protected void onCreate(Bundle savedInstanceState) { mCursor = managedQuery(CONTENT_URI, PROJECTION, null, null, "_id DESC"); mAdapter = new SimpleCursorAdapter(this,R.layout.list_content, mCursor, keys, values); setListAdapter(mAdapter); } In my defined listview, i want to load more items by query database. public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { int lastItem = firstVisibleItem + visibleItemCount - 1; if (mListAdapter != null) { if ((lastItem == mListAdapter.getCount()-1) && (mRefr

Is Titanium 1.8 finally free from the memory starvation issue from release 1.6 and 1.7

Hi there Im new to mobile application development. I had developed Android apps using Java and is just starting to get the hang of Cocoa Touch and Objective C. Now I am curious on mobile web application development to create cross platform/device applications which would at least run on Android and iOS(Apple devices: iphone, ipad). I tried Titanium and developing applications with this framework seems very promising. Although it is very powerful, popular, mature, documented and very easy to learn I had doubts investing time and to commit on using this framework for my projects after reading this blog which many Titanium users seems to agree with Why you should stay away from appcelerators titanium . It seems that release v1.6 sdk and v1.7 sdk have the issue which they describe, the negative comments stopped right after the v1.8 sdk release was out. My question is, is Titanium v1.8 sdk free from the memory starvation issue and other issues which were discussed on the blog post?

Memory-leak android using arrays and files

I'm developing a dictionary using *.txt files in /raw directory, also I have a history (current 18 entries). Every OnResume() I'm getting history entries from file on SDCard and filling ListArray 's than use ArrayAdapter to fill a ListView . I can't understand why I have a big memory leak (every onResume() adds about 4-6 MB to the memory). Please help me. Here is my code: public class SecondTab extends Activity { ListView lv1; ArrayList <String> ArrayHist = new ArrayList <String>(); ArrayList <String> ArrayHistMin = new ArrayList <String>(); BufferedReader Buffer; InputStream file; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hist); SetContent(); if (ru.andr.dictu.FirstTab.myErrorInHist) { Toast.makeText(this, getString(R.string.err_hist), Toast.LENGTH_LONG).show(); } } public vo

Android Creating button dynamically and fill layout

I'm creating a button dynamically. The number of button is depend on the size of arraylist. the problem is, after creating the button I will add to the layout using addview method. The problem is I'm using linear layout, as by default orientation for linear layout is horizontal, so the button will fill the layout horizontally. Because of that some of the button is not visible. What I'm trying to achieve is something look like this My code is like below: Button[] tv = new Button[arraylist.size()]; for(int i=0;i<arraylist.size();i++){ tv[i] = new Button(getApplicationContext()); tv[i].setText(arraylist.get(i).toString()); tv[i].setTextColor(Color.parseColor("#000000")); tv[i].setTextSize(20); tv[i].setPadding(15, 5, 15, 5); linearlayout.addView(tv[i]); } If I set the orientation of linear layout to vertical the button will fill vertically. So if there any solution to create the button dynamical

No resource identifier found for attribute &#39;contentDescription&#39; in package &#39;android

I had this warning before "" [Accessibility] Missing contentDescription attribute on image " on ImageView and then I added this code to it: android:contentDescription="@string/desc" and now I'm facing with an error No resource identifier found for attribute 'contentDescription' in package 'android This is my code: <ImageView android:id="@+id/handle" android:layout_width="48dip" android:layout_height="48dip" android:contentDescription="@string/desc" android:src="@drawable/icon" />

Resources for studying the Android kernel

Ive been trying to study the Android kernel but I cant find any resource that dwells into the depths of the topic. I wanted to look into how Android specifically handles scheduling, garbage-collection, synchronization and how it implements its file-system. I understand that Android is based on the Linux kernel, but there are many dis-similarities between the two. Any idea where can I get a detailed explanation of the above topics with respect to the Android kernel? PS:I have already looked into Processes and Threads at the dev site and This post on scheduling Thx.

PreferenceActivity background in ics is gone during scroll

i'm using PreferenceActivity in my app for settings and when tried to set a background and it looks fine untill the user scroll. during the scroll there is background only below the text (see links to images below) after the scroll it goes back to how it was before (the way it should look) the problem happens only on ics (on nexus one it works fine) did anyone saw that problem before and know how to fix it? thanks. thats how it looks before scrolling http://i.stack.imgur.com/4aPKX.png and thats how it looks during scrolling http://i.stack.imgur.com/zDbgU.png

Android SQLite query with &#39;WHERE&#39; selection arguments not working

I have this code: if (idListe.size()>0) { strIdArray = new String[idListe.size()]; idListe.toArray(strIdArray); //my query starts here c = dbHelper.query(true, DataBaseHelper.DB_COURSE, dbHelper.COURSE_TABLE_AUFGABEN, new String[] { dbHelper.COURSE_AUFGABEN_COLUMN_ID, dbHelper.COURSE_AUFGABEN_COLUMN_ADRESSID, dbHelper.COURSE_AUFGABEN_COLUMN_KURSART }, dbHelper.COURSE_AUFGABEN_COLUMN_ID + " = ?",strIdArray, dbHelper.COURSE_AUFGABEN_COLUMN_KURSART, null, dbHelper.COURSE_AUFGABEN_COLUMN_KURSART + " ASC", null); startManagingCursor(c); } And get a this error: 01-15 13:01:27.489: E/AndroidRuntime(703): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x3fd490 I've tried several combinations and the result always stays the same. If the size of the strIdArray is '1' the

Overriding android:ellipsize on ActionBar subtitle

My activity makes use of the ActionBar.setSubtitle function to display the currently displayed file system location's full path. This means that the substring towards the end of the subtitle is more relevant than the beginning, so I thought I would override the ActionBar style to ellipsize text at the start, rather than the end, like so: res/values/themes.xml <style name="Theme.Holo" parent="android:Theme.Holo"> <!-- Action bar styles --> <item name="android:actionBarStyle">@style/Widget.Holo.ActionBar</item> </style> res/values/styles.xml <style name="Widget.Holo.ActionBar" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:subtitleTextStyle">@style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item> </style> <style name="TextAppearance.Holo.Widget.ActionBar.Subtitle" parent="@android:style/TextAppearance.Ho

Android display Images regardless dpi

I need to run my application on multiple devices with diffrent specs. Now I'm trying to get it work on just two: Samsung Galaxy tab p100 and Galaxy tab 7.0 plus the differnces I'm care about now are dpi,the first device is 240 dpi the second is 170 and the version the first runs 2.2 he later 3.2 first I put the Images on the hdpi folder images on 7.0 plus is smaller and ugly so I copied them to mdpi folder works fine but this would double the size of my APK. Is there any way to make android auto fit Images without the need to copy Images?