Archive for the ‘Android’ Category

08
Dec

Create an Image button first:

ImageButton btnPrev;

The following code will hide the image button btnPrev:

btnPrev.setVisibility(View.INVISIBLE);

The following code will show the image button btnPrev:

btnPrev.setVisibility(View.VISIBLE);

If you want conditionally make the image button visible, then you add script like following:

if( page == 1 ){
btnPrev.setVisibility(View.INVISIBLE);
}else{
btnPrev.setVisibility(View.VISIBLE);
}

08
Dec

Droiddraw – GUI for the Android cell phone platform

This tool was written to make my Java programming life easier. It can be used to build graphical user interfaces for the Android cell phone platform.

You can download droiddraw from following url:

http://www.droiddraw.org/

08
Dec

First of all, you have to add ScrollView in the main.xml and give ‘Scroll’ as its id. After that you have to open your .java file and add following code in it:

ScrollView scrollView;

TextView textView;

scrollView = (ScrollView) findViewById(R.id.Scroll);
scrollView.bringToFront();
textView = new TextView(this);
textView.setTextColor(Color.BLACK);
scrollView.addView(textView);

Thats it!

07
Dec


Nearly every text field on an Android device can be filled with a few words from your mouth, and it works surprisingly well. You can respond to emails by voice, send long text messages by voice while you’re walking around Target, respond to your editor’s IMs while you’re at a graduation ceremony, and so on, as long as you’re comfortable talking to your phone (it is a phone, so you should be). Apart from voice-to-text in third party apps, iOS doesn’t support voice-to-text at all.

07
Dec

A Starting Point
You can evaluate iPhone and Android devices from countless angles,[1] so rather than pretend that we’ve got the One True Comparison, it only seems appropriate to highlight that we’re not necessarily your average user. For more specifics on how we judge these devices, read this footnote. More »

07
Dec

The following script will show you how to change image of an ImageButton in Android:

//Create an image button instant

ImageButton btnPlay;

//set btnPlay object to main.xml interface. You have to add an image button to main.xml file and name the id "btnPlay"

btnPlay = (ImageButton) findViewById(R.id.btnPlay);

// Add action to the image button

btnPlay.setOnClickListener( new OnClickListener(){
public void onClick(View v){

//Copy btn_pause and btn_play.png image to /res/drawable-hdpi folder.
// sets a new background image from drawable folder (/res/drawable-hdpi).
btnPlay.setBackgroundResource(R.drawable.btn_pause);
// sets a new background image from drawable folder
btnPlay.setBackgroundResource(R.drawable.btn_play);
}
});

Thats it.

06
Dec

The following script will checks and stops the media player in android when you change from one page to another:

if( mediaPlayer.isPlaying() ){
mediaPlayer.release();
}

03
Dec

Micromax has launched its first Google Android running handset dubbed A60 Andro for Rs. 6,999.

The Micromax A60 runs Android 2.1 and comes with a full touch 2.8-inch resistive display with a resolution of 240 x 320 pixels and 65K color display. It is powered by a 600 MHz processor. It has a variety of applications including GPS for location tracking or turn-by-turn directions, compass, Proximity Sensor and so on. The A60 Andro comes with a 3.2 megapixel autofocus camera. Connectivity options include Bluetooth 2.1, Wi-Fi 802.11 b/g and USB 2.0.

A60 Andro has accelerator sensor which allow users to show off your content in portrait or landscape orientation with every turn. It has a 150 MB internal memory and is 32GB External Micro SD card supported.

Spec-wise, it seems more or less similar to the Samsung Galaxy 5 i5503, which costs about Rs. 1,500 more, except for one major drawback – the resistive screen. The Galaxy 5 on the other hand has the finger-friendly and fairly responsive (we’ve tried it out) touch response due to its capacitive nature. While we haven’t tried out the Andro’s screen, having used resistive screens before, we can guesstimate the Samsung’s to be better.

01
Dec

This video explains how to use PhoneGaps inside android so that one can create android application using HTML,CSS,JavaScript.
• Create an android project
a)go to file->new->android project
b)Give project name,application name,package name and
activity name
c)Note that while you select android target version you go for
latest version
d)click on finish ,and the project is created
• Inside Project folder open src and you can see a .java file before making changes
on it we have to include an extra file to the project.
• Right click on specified project -> build path ->add external archives->select the
.jar file ->click on open.The .jar file can be seen inside reference libraries inside
project.
• In .java file change the Activity as DroidGap and change the statement
setContentView(R.layout.main);
as
super.loadUrl(“file:///android_asset/www/index.html”);
• Import DroidGap and remove unused imports.
• Go to asset create new folder www
• Inside www create a file index.html.PhoneGaps identifies only index.html file so
the name should not be changed.
• Inside index.html write appropriate code for printing helloworld.
• save the project and run it
• you can see helloworld printed.

29
Nov

Preference values is done by first crearting an object of PreferenceManager. This is the default storage

SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(this);

We can retrieve the stored values using. Here str1 and str2 contains values that is stored.
if no values present then the valoe ’0′ is returned.

 String str1 = app_preferences.getString("DURATION","0");
 String str2 = app_preferences.getString("INTERVAL","0");

Inserting the values is done using the code given below.

SharedPreferences.Editor editor = app_preferences.edit();
					     editor.putString("DURATION",value));
					     editor.commit();