Difference between revisions of "Android Controller"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(Android Basics:)
(Android Basics:)
Line 19: Line 19:
 
* UI Components
 
* UI Components
 
**Buttons
 
**Buttons
<blockquote><code>Button button = (Button)findViewById(R.id.button1);
+
<pre>
button.setOnClickListener(buttonOnClick);</code></blockquote>
+
Button button = (Button)findViewById(R.id.button1);
 +
button.setOnClickListener(buttonOnClick);
 +
</pre>
 
**Sliders
 
**Sliders
<blockquote><code>SeekBar seekbar=(SeekBar)findViewById(R.id.seekBar1);
+
***<pre>
seekbar.setOnSeekBarChangeListener(sbar);</code></blockquote>
+
SeekBar seekbar=(SeekBar)findViewById(R.id.seekBar1);
 +
seekbar.setOnSeekBarChangeListener(sbar);
 +
</pre>
 
**TextView
 
**TextView
<blockquote><code>
+
<pre>
 
TextView seekbartxt=(TextView)findViewById(R.id.seekBarText);
 
TextView seekbartxt=(TextView)findViewById(R.id.seekBarText);
 
CharSequence t="slider progress:"+progress;
 
CharSequence t="slider progress:"+progress;
seekbartxt.setText(t);</code></blockquote>
+
seekbartxt.setText(t);
 +
</pre>
 
* Listeners
 
* Listeners
 
**OnClickListener
 
**OnClickListener
<blockquote><code>private OnClickListener showCamera = new OnClickListener() {
+
<pre>
 +
private OnClickListener showCamera = new OnClickListener() {
 
    public void onClick(View v) {
 
    public void onClick(View v) {
 
    //do stuff here
 
    //do stuff here
             }</code></blockquote>
+
             }
 +
</pre>
 
**OnSeekBarChangeListener
 
**OnSeekBarChangeListener
<blockquote><code>
+
<pre>
 
private SeekBar.OnSeekBarChangeListener sbar = new SeekBar.OnSeekBarChangeListener()
 
private SeekBar.OnSeekBarChangeListener sbar = new SeekBar.OnSeekBarChangeListener()
 
{
 
{
Line 49: Line 56:
 
boolean fromUser) {
 
boolean fromUser) {
 
}
 
}
};</code></blockquote>
+
};
 +
</pre>
  
 
* Camera
 
* Camera

Revision as of 20:45, 4 June 2011

Contents

Android Controller

Jeanne Wang

Objective

Create an intuitive and novel approach to a tablet based multi-touch and sensor-enabled controller for a real-time 3D visualization on a 2D platform. Using camera pose information relative to a 3D model displayed on a screen, we can display virtual camera shots in the 3D model space on the tablet.


Android Basics:

  • Sandboxed in a linux environment, each application is actually a user
  • Model View Controller setup
    • Model - Content providers
    • View - XML
    • Controller - Activity, or Service
  • UI Components
    • Buttons
Button button = (Button)findViewById(R.id.button1);
button.setOnClickListener(buttonOnClick);
    • Sliders

SeekBar seekbar=(SeekBar)findViewById(R.id.seekBar1); seekbar.setOnSeekBarChangeListener(sbar);

    • TextView
TextView seekbartxt=(TextView)findViewById(R.id.seekBarText);
			CharSequence t="slider progress:"+progress;
			seekbartxt.setText(t);
  • Listeners
    • OnClickListener
private OnClickListener showCamera = new OnClickListener() {
	    public void onClick(View v) {
		    	//do stuff here
            }
    • OnSeekBarChangeListener
private SeekBar.OnSeekBarChangeListener sbar = new SeekBar.OnSeekBarChangeListener()
	{
		
		public void onStopTrackingTouch(SeekBar seekBar) {			
		}
		
		public void onStartTrackingTouch(SeekBar seekBar) {
		}
		
		public void onProgressChanged(SeekBar seekBar, int progress,
				boolean fromUser) {
		}
	};
  • Camera

Hardware + Emulator

Network

  • server
  • client
  • socket issues

ARToolkit

  • detect marker
  • pose

Android

OpenCover

  • display marker
  • display dataset

Tips

  • Tip: An easy way to add import packages to your project is to press Ctrl-Shift-O (Cmd-Shift-O, on Mac). This is an Eclipse shortcut that identifies missing packages based on your code and adds them for you.
  • To get cpuinfo on a particular machine look in: /proc/cpuinfo
  • To get ipaddress on a particular machine call /sbin/ifconfig

Other possibilities

  • Corona Sdk [[1]]
  • HTML5 DeviceMotionEvent [[2]]
  • PhoneGap [[3]]