May 23, 2010

[SOLVED] Show web pages in Activity -Hello, WebView

WebView allows you to create your own web browser Activity. In this tutorial, we'll create a simple Activity that can view web pages.

Source: Hello, WebView | Android Developers.

May 20, 2010

[ANDROD] First screens of froyo. Android 2.2

Desktop screen
desktop

Launcher
desktop

Phone
desktop

Music widget + overwiev of screens
desktop

Select "Input languages" for your multi-language virtual keyboard
desktop

for example german and russian
desktop

last started apps

desktop

our german keyboard

desktop

swipe on spacebar and we will get russian keyboard

desktop

May 9, 2010

[SOLVED] Android: Set Admob programmatically into test mode


(6) When integrating AdMob ads into your application it is recommended to use test mode. In test mode test, ads are always returned.


Test mode is enabled on a per-device basis. To enable test mode for a device, first request an ad, then look in LogCat for a line like the following:



  To get test ads on the emulator use AdManager.setTestDevices...

Once you have the device ID you can enable test mode by calling AdManager.setTestDevices:



  AdManager.setTestDevices( new String[] {                 
AdManager.TEST_EMULATOR, // Android emulator
"E83D20734F72FB3108F104ABC0FFC738", // My T-Mobile G1 Test Phone
} );



Source: Android - Admob For Developers.

May 6, 2010

[SOLVED] Android: hide/disable soft keyboard for activity


Just put stateAlwaysHidden attribute in your Manifest



 <activity name="EditContactActivity"
android:windowSoftInputMode="stateAlwaysHidden">
...
</activity>



Source: The AndroidManifest.xml File </activity>

May 5, 2010

[SOLVED] Android: How to stress/test your app with random streams of user events

The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.


$ adb shell monkey -p your.package.name -v 500



UI/Application Exerciser Monkey Android Developers.

May 2, 2010

[Solved] Android: Check if SD card is present



  1. public static boolean isSdPresent() {

  2. return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);

  3. }




Source: Android Snippets: Check if SD card is present.

[SOLVED] How-To HOW TO convert any video to your Nexus One

Source: How-To HOW TO convert any video to your Nexus One - Nexus One Forum - Google Phone Forum.

[SCREENCAST]How to do Unit Testing on Android with Eclipse

Source: How to do Unit Testing on Android with Eclipse - Gubatron.com.

[SOLVED] How to catch changes on "Key Press" from Soft Keyboard in EditText

editText.addTextChangedListener(new TextWatcher());  this interface
contains three methods,  which will be called accordingly when you
type using soft keyboard.





Source: Handling "Key Press" from Soft Keyboard in EditText - Android Developers | Google Groups.

[SOLVED] How to center window title

Just put in onCreate


TextView t=(TextView) findViewById(android.R.id.title);
t.setGravity(Gravity.CENTER_HORIZONTAL);





Alternative solution: http://andmobidev.blogspot.com/2010/01/centering-title-of-window.html

Source: Issue 4395 - android - android:gravity property ignored by TextAppearance.WindowTitle or WindowTitle - Project Hosting on Google Code.

May 1, 2010

[SOLVED] Error on creating custom dialog

> Use dialog = new Dialog(this);
> instead of
> dialog = new Dialog(getApplicationContext());


private void showAbout() {
showDialog(DIALOG_ABOUT_ID);
}

protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch (id) {
case DIALOG_ABOUT_ID:
dialog = new Dialog(this);

dialog.setContentView(R.layout.about);
dialog.setTitle("Custom Dialog");
dialog.setOwnerActivity(this);

TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_contact_picture);

break;
// case DIALOG_GAMEOVER_ID:
// // do the work to define the game over Dialog
// break;
default:
dialog = null;
}
return dialog;
}






Source: Custom Dialog - Android Developers | Google Groups.

[SOLVED]Android: How to Make an Activity Fullscreen



  1. public class FullScreen extends Activity {

  2. @Override

  3. public void onCreate(Bundle savedInstanceState) {

  4. super.onCreate(savedInstanceState);


  5. requestWindowFeature(Window.FEATURE_NO_TITLE);

  6. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

  7. WindowManager.LayoutParams.FLAG_FULLSCREEN);


  8. setContentView(R.layout.main);

  9. }

  10. }




Source: Android Snippets: How to Make an Activity Fullscreen.