|
Hi
I have a general type of question. I have an IP camera which supports 3GP container(3GPP file format) video streaming. I need to show the feed from that camera in a windows mobile app(using .NET CF). Does anybody have any experiencies with this type of programming? Any help (links, documents, sample code, advices ...) will be appreciated.
Uroš Bregar
|
|
|
|
|
Hi,
I need some help. My programme doesn't show the value of the sensor movement. There's no error in the code. So I'm not sure what to do. Thanks in advance.
[code]package com.example.testsensors;
import com.example.testsensors.ChronometerDemo1;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorManager;
import android.hardware.SensorListener;
import android.util.Log;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
public class TestSensors extends ChronometerDemo1 {
private static final String TAG = "Sensors";
private SensorManager mSensorManager;
private GraphView mGraphView;
private class GraphView extends View implements SensorListener
{
private Bitmap mBitmap;
private Paint mPaint = new Paint();
private Canvas mCanvas = new Canvas();
private Path mPath = new Path();
private RectF mRect = new RectF();
private float mLastValues[] = new float[3*2];
private float mOrientationValues[] = new float[3];
private int mColors[] = new int[3*2];
private float mLastX;
private float mScale[] = new float[2];
private float mYOffset;
private float mMaxX;
private float mSpeed = 1.0f;
private float mWidth;
private float mHeight;
public GraphView(Context context) {
super(context);
mColors[0] = Color.argb(192, 255, 64, 64);
mColors[1] = Color.argb(192, 64, 128, 64);
mColors[2] = Color.argb(192, 64, 64, 255);
mColors[3] = Color.argb(192, 64, 255, 255);
mColors[4] = Color.argb(192, 128, 64, 128);
mColors[5] = Color.argb(192, 255, 255, 64);
mPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mRect.set(-0.5f, -0.5f, 0.5f, 0.5f);
mPath.arcTo(mRect, 0, 180);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
mCanvas.setBitmap(mBitmap);
mCanvas.drawColor(0xFFFFFFFF);
mYOffset = h * 0.5f;
mScale[0] = - (h * 0.5f * (1.0f / (SensorManager.STANDARD_GRAVITY * 2)));
mScale[1] = - (h * 0.5f * (1.0f / (SensorManager.MAGNETIC_FIELD_EARTH_MAX)));
mWidth = w;
mHeight = h;
if (mWidth < mHeight) {
mMaxX = w;
} else {
mMaxX = w-50;
}
mLastX = mMaxX;
super.onSizeChanged(w, h, oldw, oldh);
}
@Override
protected void onDraw(Canvas canvas) {
synchronized (this) {
if (mBitmap != null) {
final Paint paint = mPaint;
final Path path = mPath;
final int outer = 0xFFffff00;
final int inner = 0xFFcd5c5c;
if (mLastX >= mMaxX) {
mLastX = 0;
final Canvas cavas = mCanvas;
final float yoffset = mYOffset;
final float maxx = mMaxX;
final float oneG = SensorManager.STANDARD_GRAVITY * mScale[0];
paint.setColor(0xFFAAAAAA);
cavas.drawColor(0xFFFFFFFF);
cavas.drawLine(0, yoffset, maxx, yoffset, paint);
cavas.drawLine(0, yoffset+oneG, maxx, yoffset+oneG, paint);
cavas.drawLine(0, yoffset-oneG, maxx, yoffset-oneG, paint);
}
canvas.drawBitmap(mBitmap, 0, 0, null);
float[] values = mOrientationValues;
if (mWidth < mHeight) {
float w0 = mWidth * 0.333333f;
float w = w0 - 32;
float x = w0*0.5f;
for (int i=0 ; i<3 ; i++) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.translate(x, w*0.5f + 4.0f);
canvas.save(Canvas.MATRIX_SAVE_FLAG);
paint.setColor(outer);
canvas.scale(w, w);
canvas.drawOval(mRect, paint);
canvas.restore();
canvas.scale(w-5, w-5);
paint.setColor(inner);
canvas.rotate(-values[i]);
canvas.drawPath(path, paint);
canvas.restore();
x += w0;
}
} else {
float h0 = mHeight * 0.333333f;
float h = h0 - 32;
float y = h0*0.5f;
for (int i=0 ; i<3 ; i++) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.translate(mWidth - (h*0.5f + 4.0f), y);
canvas.save(Canvas.MATRIX_SAVE_FLAG);
paint.setColor(outer);
canvas.scale(h, h);
canvas.drawOval(mRect, paint);
canvas.restore();
canvas.scale(h-5, h-5);
paint.setColor(inner);
canvas.rotate(-values[i]);
canvas.drawPath(path, paint);
canvas.restore();
y += h0;
}
}
}
}
}
public void onSensorChanged(int sensor, float[] values) {
synchronized (this) {
if (mBitmap != null) {
final Canvas canvas = mCanvas;
final Paint paint = mPaint;
if (sensor == SensorManager.SENSOR_ORIENTATION) {
for (int i=0 ; i<3 ; i++) {
mOrientationValues[i] = values[i];
}
} else {
float deltaX = mSpeed;
float newX = mLastX + deltaX;
int j = (sensor == SensorManager.SENSOR_MAGNETIC_FIELD) ? 1 : 0;
for (int i=0 ; i<3 ; i++) {
int k = i+j*3;
final float v = mYOffset + values[i] * mScale[j];
paint.setColor(mColors[k]);
canvas.drawLine(mLastX, mLastValues[k], newX, v, paint);
mLastValues[k] = v;
}
if (sensor == SensorManager.SENSOR_MAGNETIC_FIELD)
mLastX += mSpeed;
}
invalidate();
}
}
}
public void onSensorChanged(SensorEvent event, int sensor, int accuracy) {
StringBuffer buff = new StringBuffer();
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
buff.append("ACCELEROMETER\n");
buff.append("X-axis: ").append(event.values[0]).append("\n");
buff.append("Y-axis: ").append(event.values[1]).append("\n");
buff.append("Z-axis: ").append(event.values[2]).append("\n");
TextView tv = (TextView) findViewById(R.id.accero_counters);
tv.setText(buff.toString());
Toast.makeText
(getBaseContext()
, "Accelerometer\n" + "X-axis: " + event.values[0] + "\n" + "Y-axis: " + event.values[1], Toast.LENGTH_SHORT
).show();
}
}
@Override
public void onAccuracyChanged(int sensor, int accuracy) {
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mGraphView = new GraphView(this);
setContentView(mGraphView);
}
@Override
protected void onResume() {
super.onResume();
mSensorManager.registerListener(mGraphView,
SensorManager.SENSOR_ACCELEROMETER |
SensorManager.SENSOR_MAGNETIC_FIELD |
SensorManager.SENSOR_ORIENTATION,
SensorManager.SENSOR_DELAY_FASTEST);
}
@Override
protected void onStop() {
mSensorManager.unregisterListener(mGraphView);
super.onStop();
}
}[/code]
|
|
|
|
|
Hi all, I'm trying to call my 'ChronometerDemo1' class from 'TestSensors' but its just not working. Need some help. Sorry if its abit long. Thanks in advance.
TestSensors.java
<br />
package com.example.testsensors;<br />
<br />
import android.app.Activity;<br />
import android.content.Context;<br />
import android.os.Bundle;<br />
import android.os.SystemClock;<br />
import android.util.Log;<br />
import android.view.Menu;<br />
import android.widget.Chronometer;<br />
import android.widget.Toast;<br />
<br />
public class ChronometerDemo1 extends Activity {<br />
private static final String TAG = "CustomChronometerActivity";<br />
private static final String MS_ELAPSED = "com.etc.etc.MsElapsed";<br />
<br />
private static MyChronometer chrono;<br />
<br />
<br />
@Override<br />
public void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
<br />
chrono = new MyChronometer(this);<br />
chrono.start();<br />
setContentView(chrono);<br />
}<br />
<br />
@Override<br />
protected void onPause() {<br />
Log.i(TAG, "onPause()");<br />
super.onPause();<br />
chrono.stop();<br />
}<br />
<br />
@Override<br />
protected void onResume() {<br />
Log.i(TAG, "onResume()");<br />
super.onResume();<br />
chrono.start();<br />
}<br />
<br />
@Override<br />
protected void onSaveInstanceState(Bundle outState) {<br />
super.onSaveInstanceState(outState);<br />
Log.i(TAG, "onSaveInstanceState()");<br />
chrono.stop();<br />
outState.putInt(MS_ELAPSED, chrono.getMsElapsed());<br />
}<br />
<br />
@Override<br />
protected void onRestoreInstanceState(Bundle savedInstanceState) {<br />
super.onRestoreInstanceState(savedInstanceState);<br />
Log.i(TAG, "onRestoreInstanceState()");<br />
int ms = savedInstanceState.getInt(MS_ELAPSED);<br />
chrono.setMsElapsed(ms);<br />
chrono.start();<br />
}<br />
<br />
class MyChronometer extends Chronometer {<br />
<br />
public int msElapsed;<br />
public boolean isRunning = false;<br />
<br />
public MyChronometer(Context context) {<br />
super(context);<br />
}<br />
<br />
public int getMsElapsed() {<br />
return msElapsed;<br />
}<br />
<br />
public void setMsElapsed(int ms) {<br />
setBase(getBase() - ms);<br />
msElapsed = ms;<br />
}<br />
<br />
@Override<br />
public void start() {<br />
super.start();<br />
setBase(SystemClock.elapsedRealtime() - msElapsed);<br />
isRunning = true;<br />
}<br />
<br />
@Override<br />
public void stop() {<br />
super.stop();<br />
if(isRunning) {<br />
msElapsed = (int)(SystemClock.elapsedRealtime() - this.getBase());<br />
}<br />
isRunning = false;<br />
}<br />
}<br />
<br />
public static void onCreate() {<br />
chrono.start(); <br />
}<br />
}
|
|
|
|
|
ChronometerDemo1.java
package com.example.testsensors;<br />
<br />
import android.app.Activity;<br />
import android.content.Context;<br />
import android.os.Bundle;<br />
import android.os.SystemClock;<br />
import android.util.Log;<br />
import android.view.Menu;<br />
import android.widget.Chronometer;<br />
import android.widget.Toast;<br />
<br />
public class ChronometerDemo1 extends Activity {<br />
private static final String TAG = "CustomChronometerActivity";<br />
private static final String MS_ELAPSED = "com.etc.etc.MsElapsed";<br />
<br />
private static MyChronometer chrono;<br />
<br />
<br />
@Override<br />
public void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
<br />
chrono = new MyChronometer(this);<br />
chrono.start();<br />
setContentView(chrono);<br />
}<br />
<br />
@Override<br />
protected void onPause() {<br />
Log.i(TAG, "onPause()");<br />
super.onPause();<br />
chrono.stop();<br />
}<br />
<br />
@Override<br />
protected void onResume() {<br />
Log.i(TAG, "onResume()");<br />
super.onResume();<br />
chrono.start();<br />
}<br />
<br />
@Override<br />
protected void onSaveInstanceState(Bundle outState) {<br />
super.onSaveInstanceState(outState);<br />
Log.i(TAG, "onSaveInstanceState()");<br />
chrono.stop();<br />
outState.putInt(MS_ELAPSED, chrono.getMsElapsed());<br />
}<br />
<br />
@Override<br />
protected void onRestoreInstanceState(Bundle savedInstanceState) {<br />
super.onRestoreInstanceState(savedInstanceState);<br />
Log.i(TAG, "onRestoreInstanceState()");<br />
int ms = savedInstanceState.getInt(MS_ELAPSED);<br />
chrono.setMsElapsed(ms);<br />
chrono.start();<br />
}<br />
<br />
class MyChronometer extends Chronometer {<br />
<br />
public int msElapsed;<br />
public boolean isRunning = false;<br />
<br />
public MyChronometer(Context context) {<br />
super(context);<br />
}<br />
<br />
public int getMsElapsed() {<br />
return msElapsed;<br />
}<br />
<br />
public void setMsElapsed(int ms) {<br />
setBase(getBase() - ms);<br />
msElapsed = ms;<br />
}<br />
<br />
@Override<br />
public void start() {<br />
super.start();<br />
setBase(SystemClock.elapsedRealtime() - msElapsed);<br />
isRunning = true;<br />
}<br />
<br />
@Override<br />
public void stop() {<br />
super.stop();<br />
if(isRunning) {<br />
msElapsed = (int)(SystemClock.elapsedRealtime() - this.getBase());<br />
}<br />
isRunning = false;<br />
}<br />
}<br />
<br />
public static void onCreate() {<br />
chrono.start(); <br />
}<br />
}
|
|
|
|
|
Do not post the same question in more than one forum. It annoys people, and they won't answer your question.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Hi All,
I am new to Andriod Development, and i am using Eclipse java IDE.
i am having troubles when i edit any files. The application is working fine unless each time if you need to change in any of the layout files or manifiest. (baiscally the XML files) it always troubling me
just generating a empty of the file name with an "out" extention. example main.out.xml.
then i have do delete the file and uload/load project manytimes and then it will come back to normal. this problem making me nurvois to change any files.
can anybody tell me what is exactly the cause of this problem?
thanks
Hussain Mohammed Saleh Attiya
ISP Technical Manager
Atyaf Telcom - Bahrain
|
|
|
|
|
Hi,
at last i found the solutions in one of the forums
ye but its still a bug. pretty amazing this survived beta.
forums i read said you need to:
1) delete the main.out.xml file
2) close all layout files
3) select a .java file or the project node and then try to run
nup. Still didn't work. I finally found out, purely by accident, that you also need to delet the compoile error that appears under the problems tab.
Hussain Mohammed Saleh Attiya
ISP Technical Manager
Atyaf Telcom - Bahrain
|
|
|
|
|
Hi everyone,
I not really good with programming, so I need some help. Does anybody know how to create a stopwatch for an Android phone using Java programming? Thanks in advance.
|
|
|
|
|
You could store the System.currentTimeMillis() in a long upon a start button press to note the start time. When someone presses stop read the System.currentTimeMillis() again and substract the already stored value from the start. Now you are left with the amount of milli seconds that passed between the two events.
|
|
|
|
|
Hi, thanks for your help. But I don't know where to start. So this is what I have found so far. Thanks in advance for the help.
package com.novoda.runbuddy.activity;<br />
<br />
public class StopWatch {<br />
<br />
private long startTime = 0;<br />
private long stopTime = 0;<br />
private long elapsed = 0;<br />
private boolean running = false;<br />
<br />
<br />
public void start() {<br />
this.startTime = System.nanoTime();<br />
this.running = true;<br />
}<br />
<br />
<br />
public void stop() {<br />
this.stopTime = System.nanoTime();<br />
this.running = false;<br />
}<br />
<br />
public void reset() {<br />
this.startTime = 0;<br />
this.stopTime = 0;<br />
this.running = false;<br />
}<br />
<br />
public long getElapsedTimeMicro() {<br />
if (running) {<br />
elapsed = ((System.nanoTime() - startTime) / 1000);<br />
}<br />
else {<br />
elapsed = ((stopTime - startTime) / 1000);<br />
}<br />
return elapsed;<br />
}<br />
<br />
public long getElapsedTimeMilli() {<br />
if (running) {<br />
elapsed = ((System.nanoTime() - startTime) / 1000000);<br />
}<br />
else {<br />
elapsed = ((stopTime - startTime) / 1000000);<br />
}<br />
return elapsed;<br />
}<br />
}
|
|
|
|
|
Hi,
I'm kinda new to programming and with not much knowledge on Java. But this is urgent!! I need help in research. I'm need to create a mobile application using Android and Eclipse.
Objectives:
To develop a mobile application that would be able to push help messages in the event whereby the mobile user requires assistance.
Scope of project:
Develop a mobile application that;
A module to detect movements
A decision making module with the intelligence to trigger an alert based on a set of rules
A module to push an alert message to a 3rd party e.g. via the SMS
Any ideas on how I should go about doing this? Thanks.
Best Regards,
|
|
|
|
|
-- Download SDK[SDK ^] for Android.
-- Download the development tools - can get from the previous link
-- Read the development articles.
-- Start your Hello World application.
-- Think & plan for your project
"He that is good with a hammer tends to think everything is a nail." - Abraham Maslow
|
|
|
|
|
I want to create Menu,Menu item , POP up menu and table like gui using MIDP 2.0 . How it is possible
Trioum
|
|
|
|
|
hi there,
Im really confused! i need to connect sql server from my pocket pc ...
i made a wireless network and connect them to each other.
now with this code i try to connect ...
SqlConnection con = new SqlConnection(@"Data Source=mohsen-pc\sqlexpress;Initial Catalog=ManagerCo;Persist Security Info=True;User ID=sa;Password=123456");
SqlCommand cmd = con.CreateCommand();
try
{
con.Open();
}
catch (Exception f)
{
MessageBox.Show(f.Message);
}
sqlexception is result!
note that firewall is switched off, sql express accepts remote and configured correctly
plz help!!!!!!!!!1
|
|
|
|
|
Would you post the exception details? That will help to determine the issue.
|
|
|
|
|
please clear your question to justify it
what is error in this code and what about exception. Mention it
then we can solved it.
|
|
|
|
|
I make program for recording phone conversation to a file.I need help. I can not find a way to start recording after receiving a call? Is there a function in the Windows Mobile API for this/
|
|
|
|
|
How to handle key events in Pocket Internet Explorer using javascript?
|
|
|
|
|
What are my options for creating websites for mobile?
What is WAP? Or use ASP.net to sniff which browser the request came from?
|
|
|
|
|
Hello
Use standard ASP.NET website project for creating mobile website. Important thing here is to detect request, if it is from mobile device than redirect user to mobile compatible pages instead of standard website.
For accurate and easy mobile device detection use http://51degrees.codeplex.com[^] It is an ASP.NET open source module which detects mobile devices and provides auto redirection to mobile optimized pages when request is coming from mobile device. It makes use of WURFL mobile device database.
Sample web.config configuration for redirecting users to different mobile pages based on MobileDeviceManufacturer property. You can create your own custom rules for redirection based on other mobile properties.
<redirect firstRequestOnly="false"
mobileHomePageUrl="~/Mobile/Default.aspx"
timeout="20"
devicesFile="~/App_Data/Devices.dat"
mobilePagesRegex="/(Apple|RIM|Nokia|Mobile)/">
<locations>
<location url="~/Apple/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="Apple"/>
</location>
<location url="~/RIM/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="RIM"/>
</location>
<location url="~/Nokia/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="Nokia"/>
</location>
</locations>
</redirect>
|
|
|
|
|
I am new for iphone technology as i was vc++ developer. I am working on record audio and got one source code "SpeakHere" that fulfill my requirement but it is to lengthy. lots of files are used there ... if someone guide me on how to record audio in minimum number of lines.
Any doc or source code ??
Thanks in advance
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
|
Is this a programming question?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
This is a discussion board for Mobile Programming questions. Unless you want to develope mobile applications for iPhone and wondering if you should go ahead and develope one for this chinese phone; you are in the wrong place.
|
|
|
|
|
I've wanted to get into development for smart phones, but the phones/plans are all so insanely expensive (at least in the US), I can't even come close to affording one right now. Not to mention multi-platform development.
I was wondering, is a phone absolutely necessary? How accurate are the emulators compared to the real thing? Is it possible to make apps without ever testing them on an actual device? I'm mainly interested in the Android and WP7 emulators.
Any info/advice would be greatly appreciated.
Thanks...
We live in a world operated by science and technology. We have also arranged things so that almost no one understands science and technology. This is a prescription for disaster. We might get away with it for a while, but sooner or later this combustible mixture of ignorance and power is going to blow up in our faces.
--Carl Sagan
|
|
|
|
|