Issue in openintents simulator, after running directly going to "Connection settings" page instead of my desired page

by Nithin » Wed, 04 Mar 2009 15:27:27 GMT


Sponsored Links
 hi,

I am trying to use open intents simulator and do all the settings
according to the instructions. But when i tried to run a sample
program, after running, its directly going to the "connections
settings page" in openintents.apk.

please guide me in this issue, heres my code...

import org.openintents.hardware.SensorManagerSimulator;
import org.openintents.provider.Hardware;

import android.app.Activity;
import android.content.Intent;
import android.hardware.SensorListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.Toast;

public class OpenPage extends Activity implements SensorListener {

        SensorManager sensorManager;
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.openpage);

                /* start open intents code */

                Hardware.mContentResolver = getContentResolver();
                sensorManager = (SensorManager)getSystemService
(SENSOR_SERVICE);
                Intent intent = new Intent(Intent.ACTION_VIEW,
Hardware.Preferences.CONTENT_URI);
                startActivity(intent);
                sensorManager.unregisterListener(this);
                SensorManagerSimulator.connectSimulator();

                /*end open intents code */

                sensorManager.registerListener(this,
SensorManager.SENSOR_ACCELEROMETER |
                           SensorManager.SENSOR_MAGNETIC_FIELD |
                           SensorManager.SENSOR_ORIENTATION,
                           SensorManager.SENSOR_DELAY_FASTEST);
        }

        @Override
    protected void onResume() {
        super.onResume();
        sensorManager.registerListener(this,
                SensorManager.SENSOR_ACCELEROMETER |
                SensorManager.SENSOR_MAGNETIC_FIELD |
                SensorManager.SENSOR_ORIENTATION,
                SensorManager.SENSOR_DELAY_FASTEST);
    }

    @Override
    protected void onStop() {
        sensorManager.unregisterListener(this);
        super.onStop();
    }

        public void onAccuracyChanged(int sensor, int accuracy) {
        }

        public void onSensorChanged(int sensor, float[] values) {
                Toast.makeText(this, Float.toString(values[0]) +"::"+
Float.toString
(values[1]) +"::"+ Float.toString(values[2]), Toast.LENGTH_SHORT).show
();
        }

}

Thanks
Nithin
--~--~---------~--~----~------------~-------~--~----~



Issue in openintents simulator, after running directly going to "Connection settings" page instead of my desired page

by (Mishail) » Wed, 04 Mar 2009 23:50:13 GMT


 It's OK since your activity starts OpenIntents by startActivity
(intent);

Your activity should resume after exiting from openintents. But please
make sure that you granted "android.permission.INTERNET"  for your
application, see  http://code.google.com/p/openintents/wiki/SensorSimulator ,
comments section, "Comment by patrickneese,  Feb 03, 2009":
There shall be <uses-permission
android:name="android.permission.INTERNET"/> for your activity




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Issue in openintents simulator, after running directly going to "Connection settings" page instead of my desired page

by nithin » Thu, 05 Mar 2009 12:15:53 GMT


 Thanks Mishail,

i hope that will help.. going to try..

Nithin




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Problem in playing MP3 over RTSP streaming on Android Phones

Hello All,

I am trying to play MP3 files over RTSP . Streaming is done using
FFMpeg. When i try to play this stream in any other player like VLC,
it gets played well. But streaming does not work on Android phones (I
have tried this on Samsung Europa, LG Optimus One, Samsung Galaxy,
Google Nexus One.) The standard media player in Android can not
understand the SDP created for MP3 files and so, it does not send RTSP
setup command.
The SDP that gets created is like :

v=0
o=- 0 0 IN IP4 192.168.1.122
s=No Name
c=IN IP4 192.168.1.122
t=0 0
a=tool:libavformat 52.64.2
m=audio 0 RTP/AVP 14
b=AS:64
a=control:streamid=0

And VLC player can play this SDP file.

Thanks in advance.

-- 

2. Custom Layout and big view in smaller layout

Hi everyone,

In an app that I work on, I need to have view (an image most of the
time, but sometimes it's some text), which sometimes is in an expended
state and sometimes in a unexpended size, depends on some events. The
change of state is done with an animation.

For exemple in the middle of the screen, my image which is 70dip
height and fill screen in width in expended state, but when it's in
unexpended state it should be 20dip height and still fill screen in
width.
My view (image or text) should neither be deformed, nor be resized
visually. It should only show just the 20dip at the top of the view,
and the rest is not visible.

An optional functionality, is that in expended state the view should
be on top of the rest of content of the screen.


I have tried a lot of things like an imageview or textview in a
relativelayout which adjust its size depending on the state of the
view, but i failed to get it work.

So now I think the best way is to create my own custom layout which
will keep the size of its children to not deform them, it will also
calcul its size depending on the state (expended/unexpended).
To achieve this, I've read some presentation like "Dive into Android"
from Chet Haase and Romain Guy, and android docs (http://
developer.android.com/guide/topics/ui/custom-components.html).
But I still have some problems with the calculation of size by the
custom layout, if anyone know a good tutorial about this or have
another idea about how to do this ?


Thanks for reading and your possible help

-- 

3. ColdFusion and Android development

4. Apk to detect external USB keyboard

5. How to call web services in Android emulator

6. Making new keyboard

7. Two listviews scrolling in lockstep