android

Android ending call and going to home screen

I tried to make an Android program where I can call a single number by clicking button. Works fine but as I end calling, the emulator shows call log. Instead of this I would that my program returns to the screen where is that calling button I made. How can I do this? My code is now like this ((Button) findViewById(R.id.soita)).setOnClic...

Android : background transparency behind my dialog ?

Here the code... mProgressDialog = new ProgressDialog(this); mProgressDialog.setIcon(R.drawable.ic_dialog_time); mProgressDialog.setMessage("Chargement du flux TV..."); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgressDialog.setMax(MAX_PROGRESS); mProgressDialog.setButton(getText(R.string.alert_dialog_cancel),...

Android ScrollView layout problem

I have several ListViews in a LinearLayout. It's listing things by day, so I have a TextView containing "Sunday:" followed by a list of items, followed by a "Monday" TextView, etc. Works great, but doesn't fit in the screen. So I added a ScrollView as a parent of the LinearLayout. Now it scrolls, but the ListViews all have room for 2...

Create TableLayout programatically

Hi, I'm trying to create a TableLayout programatically. It just won't work. The same layout in an xml file works though. This is what I have: public class MyTable extends TableLayout { public MyTable(Context context) { super(context); setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutPara...

Android: Is it possible to have multiple styles inside a TextView?

I was wondering if its possible to set multiple styles for different pieces of text inside a TextView. For instance, I am setting the text as follows: descbox.setText(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3); Now, is it possible to have a different style for each text element? I mean bold for line1, normal fo...

Controlling compiler options in Eclipse

Is there a way to control the optimization level of the java compiler that Eclipse uses when building a project? Or is this question not relevant anymore, is all optimization deferred to the vm? The reason I'm asking is that I recently wrote a quick test doing this: private static int test_f(int i) { return i * 42; } ... int z = 41; ...

Android: HTTP/JSON communication within application or separate thread?

I've an application which receives and sends data (JSON) from/to a HTTP server via HTTP POST requests. There is not really any payload except of a few strings, so I'm wondering if it would make sense to build this whole HTTP communication as an Android Service or just to create a separate thread within my application? ...

It it necessary to learn J2ME for Android or iPhone development?

I want to learn mobile programming, specifically Android or iPhone programming, but not sure if it is necessary to learn J2ME before working with Android or iPhone. I know only core Java (and OOP concepts very well). I need your suggestion, especially if any one working in mobile development field. Hoping for favorable reply...! Thanks....

Aborting ViewGroup if a condition is not met ?

My custom ViewGroup expects a certain number of strings for an array specified in arrays.xml. I want the app to stop if that condition is not met. What is the best practice for this? Should I just throw an IllegalStateException from the ViewGroup constructor ? public MyViewGroup( Context context, AttributeSet attrs ) { super( contex...

Android: Which is a better design choice? Lazy Loading or Initial Waiting Time?

I have been an avid fan of lazy loading but yesterday I was talking with a fellow programmer who showed me another application and expressed how happy he was about the initial waiting time that the application takes (Android Marketplace to be precise) to load up the list and allow him to scroll smoothly than implement lazy loading and ma...

Android: combining text & image on a Button or ImageButton

I'm trying to have an image (as the background) on a button and add dynamically, depending on what's happening during run-time, some text above/over the image. If I use ImageButton I don't even have the possibility to add text. If I use Button I can add text but only define an image with android:drawableBottom and similar XML attributes...

Android: Specify two different images for togglebutton using XML

Hi folks, I'm attempting to override the default ToggleButton appearance. Here's the XML that defines the ToggleButton: <ToggleButton android:id="@+id/FollowAndCenterButton" android:layout_width="30px" android:layout_height="30px" android:textOn="" android:textOff="" android:layout_alignParentLeft="true" ...

Using m4 macros with Eclipse & Java

Is there a way to use m4 macros when developing in Java for Eclipse, ie. making sure the preprocessor is automatically invoked before Eclipse compiles? Or has anyone used another preprocessor successfully with Eclipse? ...

Android: ListView Flicker effect. Any hints on how to get rid of this?

For some reason, whenever I scroll through my list of items, the background inside my listview disappears and reappears giving rise to a "flicker" effect which I don't really want. I've tried the suggestion at: http://stackoverflow.com/questions/1377336/android-make-listview-transparent but it doesn't work for some reason. Any suggestion...

Android: Error in using onCreateOptionsMenu, not available in superclass?

Hi there, I would if anyone can help.. I am coming from a c# background so i have the syntax basics of java and i following the hello world tutorial which has 1 activity (inherits from Activity) which basically shows my view like so setContentView(R.layout.main); So what i wanted to do (by viewing a tutorial) is create a menu by...

ListView and onitemClicked effect in Android ?

Hi I have made an BaseAdapter that does not show the onclick effect on the rows when the items get selected (orange background). Im wondering what is needed to make the OnClickedItem effect appear. I tried to set the OnItemClickListener on the list, but it did not help. here is my code: private class MyAdapter extends BaseAdapter...

How can I observe for any changes to a contact

Hi, In android, how can I observe for any changes made to a contact? I know I need to register for a content observer? But what should be the URI for passing to the registerContentObserver function? Here is what I tried: registerContentObserver( ContentUris.withAppendedId(People.CONTENT_URI, personId), true, myContactsObserver); But...

Android: Has anyone solved the localhost HttpClient Connection Refused error?

I was just wondering if anyone solved this problem. Googling gives tons of posts having this question but not one with a proper reply. I tried literally every combination of the following two pieces of code with and without proxy: /*********** URL METHOD ***************/ //URLConnection conn = aURL.openConnection(); //conn.connect(); ...

Inserting breakpoints on Eclipse for an Android program

I'm using Eclipse 3.3 and Android 1.6. I installed DDMS on my Eclipse and tried to insert breakpoints as in tutorial https://www.ibm.com/developerworks/library/os-ecbug/ . However, as I run my project, the program won't stop when it reaches the breakpoint. Is there a bug in Eclipse or am I doing something wrong? ...

how to convert byte array to string and vice versa

I have to convert a byte array to string in Android, but my byte array contains negative values. If I convert that string again to byte array, values I am getting are different from original byte array values. What can I do to get proper conversion? Code I am using to do the conversion is as follows: // Code to convert byte arr to str...