Posts tagged img-style

Android MediaPlayer

The exercise play, pause and stop a mp3 file in /res/raw folder, using android.media.MediaPlayer.

Android MediaPlayer

First of all, copy a mp3 file in /res/raw folder.

main.xml

AndroidMediaPlayer.java

package com.exercise.AndroidMediaPlayer;

import android.app.Activity;import android.media.MediaPlayer;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.TextView;

public class AndroidMediaPlayer extends Activity {

 MediaPlayer mediaPlayer; Button buttonPlayPause, buttonQuit; TextView textState;

 private int stateMediaPlayer; private final int stateMP_NotStarter = 0; private final int stateMP_Playing = 1; private final int stateMP_Pausing = 2;

  /** Called when the activity is first created. */  @Override  public void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.main);

      buttonPlayPause = (Button)findViewById(R.id.playpause);      buttonQuit = (Button)findViewById(R.id.quit);      textState = (TextView)findViewById(R.id.state);

      buttonPlayPause.setOnClickListener(buttonPlayPauseOnClickListener);      buttonQuit.setOnClickListener(buttonQuitOnClickListener);

      initMediaPlayer();

  }

  private void initMediaPlayer()  {   mediaPlayer = new  MediaPlayer();      mediaPlayer = MediaPlayer.create(AndroidMediaPlayer.this, R.raw.music);      stateMediaPlayer = stateMP_NotStarter;      textState.setText("- IDLE -");  }

  Button.OnClickListener buttonPlayPauseOnClickListener   = new Button.OnClickListener(){

   @Override   public void onClick(View v) {    // TODO Auto-generated method stub    switch(stateMediaPlayer){    case stateMP_NotStarter:     mediaPlayer.start();     buttonPlayPause.setText("Pause");     textState.setText("- PLAYING -");     stateMediaPlayer = stateMP_Playing;     break;    case stateMP_Playing:     mediaPlayer.pause();     buttonPlayPause.setText("Play");     textState.setText("- PAUSING -");     stateMediaPlayer = stateMP_Pausing;     break;    case stateMP_Pausing:     mediaPlayer.start();     buttonPlayPause.setText("Pause");     textState.setText("- PLAYING -");     stateMediaPlayer = stateMP_Playing;     break;    }

   }  };

  Button.OnClickListener buttonQuitOnClickListener = new Button.OnClickListener(){

  @Override  public void onClick(View v) {   // TODO Auto-generated method stub   mediaPlayer.stop();   mediaPlayer.release();   finish();  }   };}

Download the files.

DROID, The anti digitally clueless iPhone

Being the ‘Un-cola‘ is a cool thing. So is ‘Trying Harder’. Dissing the Apple iPhone as being ‘digitally clueless’ and being the anti-iPhone is super branding strategy.

Move aside, cutesy, hold it a certain way iPhone. Droid’s here.

To stay.

Sphere: Related Content

Displays video in VideoView

The VideoView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.

Displays video in VideoView

main.xml

AndroidVideoView.java

package com.exercise.AndroidVideoView;

import android.app.Activity;import android.net.Uri;import android.os.Bundle;import android.widget.MediaController;import android.widget.VideoView;

public class AndroidVideoView extends Activity {  /** Called when the activity is first created. */  @Override  public void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.main);

      VideoView myVideoView = (VideoView)findViewById(R.id.videoview);

      String viewSource ="rtsp://v5.cache1.c.youtube.com/CjYLENy73wIaLQklThqIVp_AsxMYESARFEIJbXYtZ29vZ2xlSARSBWluZGV4YIvJo6nmx9DvSww=/0/0/0/video.3gp";

      myVideoView.setVideoURI(Uri.parse(viewSource));      myVideoView.setMediaController(new MediaController(this));      myVideoView.requestFocus();      myVideoView.start();

  }}

The App can run on real phone (tested on Nexus One), but cannot run on emulator with error of “Sorry, this video cannot be played”, may be limited by the actual performance of emulator.

Sorry, this video cannot be played.

To capture the URL of YouTube video in 3gp, browse to http://m.youtube.com/ and capture the URL.

Download the files.

Some examples of inputType on EditText

Some examples of InputType on EditText




Jung Yong Hwa ~ Collection 10 ~ Xperia X10





CN Blue ~ Collection 21 ~ Xperia X10






Scrap Yard Power Droid


“Scrap Yard Power Droid” by Jeff Soto. 24″x 36″ screen print. Hand numbered. Printed by D&L Screen Printing. Edition of 350. sold out. more info at the Mondo blog.
____________________________________

mega what?!
my ebay store | download Megatrip mixes
____________________________________

Nexus One gets new shell

If you all remember, there was a post on how I dropped my phone again (So I dropped my Nexus One… Again!).

The Google Nexus One housing replacement, Google Nexus One Replacement Touch Screen and Case-mate Barely There case has arrived!

Got these in the mail today.

Google Nexus One housing replacement, Google Nexus One Replacement Touch Screen and Case-mate Barely There case.

It wasn’t difficult to do the housing swap. All I did was follow this clip on how to dismantle the Nexus One. You’d need some tools usually used for opening phones too. A T5 screwdriver, a number 00×50 Philips screwdriver, and the plastic cellphone case opening tool.



About 45 minutes later… TA DA! Looks brand new!

No more dings, scuffs or scratches!

Next I just applied the screen protector and snapped on the Case-mate Barely There case.

Added a bit of bulk but it’s bearable.

Gmail’s Redesigned Contact Cards

Gmail’s contact cards, which show up when you mouse over the sender of a message or a Gmail Chat contact, have a new interface. Action buttons are displayed at the bottom of the card and you can no longer edit the name of a contact inline. When you click on the name of a contact, Gmail opens the contact manager.


Contacts cards haven’t changed too much since 2007, when Google released a major Gmail update.


If you’d like to see how much Gmail has evolved since 2007, open Gmail’s old version. It’s surprising to see that Gmail still offers the old version, which lacks most of the features released in the past three years.

{ Thanks, Itamar and Angelo. }

Getting ready to skin yet another droid

The inner skins are mostly cleaned off and ready to install.
I dug R4’s frame out of storage and did a test fit of the skins. The frame need some sanding in a few places for the skins to fit properly but all is looking good. If it was not raining I would do it today.