The Device Administration API provides device administration features at the system level. These APIs allow you to create security-aware applications that are useful in enterprise settings, in which IT professionals require rich control over employee devices.
Friday, 10 February 2012
Android Asset Studio : Android Icon Generating Tool
Following the Android User Interface Guidelines is important to make an app feel like it fits in naturally with the rest of the OS. A great tool to help with this is the Android Asset Studio.
Asset Studio takes basic vector shapes, clip art, and so on and makes icon resources that follow the guidelines. It supports Launcher, Menu, Action Bar, Tab and Notification icons as well as placing screenshots into phone frames.
http://code.google.com/p/android-ui-utils/
Try this link http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html in Google Chrome or Updated Firefox Beta versions.
http://code.google.com/p/android-ui-utils/
Try this link http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html in Google Chrome or Updated Firefox Beta versions.
Tuesday, 13 September 2011
Cursor management in Honeycomb
If you are targeting your application for honeycomb, then some APIs related to cursor management are deprecated and your application won't work smoothly in honeycomb, even though it will work well in other versions of Android. In Honeycomb, cursor management is more tightly coupled and Some of the APIs that are deprecated are
- startManagingCursor()
- stopManagingCursor()
- managedQuery()
- reQuery()
If you are using any of these methods in HoneyComb, then you will get an exception, like
java.lang.IllegalStateException: trying to requery an already closed cursor
If you are using managedQuery() in lower versions of Android(2.3,2.2) as,
cursor = context.managedQuery(android.provider.Browser.BOOKMARKS_URI, projection, null, null,
null);
then in Honeycomb you need to modify as,
CursorLoader cursorLoader = new CursorLoader(context, android.provider.Browser.BOOKMARKS_URI, projection, null, null,
null);
cursor = cursorLoader .loadInBackground();
Other modification is , you don't need to call reQuery in honeyComb. You have LoaderManager callbacks are there in honeyComb. That will be called if there is any change in the underlying data.
For implementing LoaderManager callbacks
- First implement the interface in your class as LoaderManager.LoaderCallbacks
- in onCreate you need to initialize the loader as
getLoaderManager().initLoader(0, null, this);
- for reQuery, you can use, getLoaderManager().restartLoader(0, null, this);
- Then you need to override three methods in it as,
- onCreateLoader()
- onLoadFinished()
- onLoaderReset()
- startManagingCursor()
- stopManagingCursor()
- managedQuery()
- reQuery()
If you are using any of these methods in HoneyComb, then you will get an exception, like
java.lang.IllegalStateException: trying to requery an already closed cursor
If you are using managedQuery() in lower versions of Android(2.3,2.2) as,
cursor = context.managedQuery(android.provider.Browser.BOOKMARKS_URI, projection, null, null,
null);
then in Honeycomb you need to modify as,
CursorLoader cursorLoader = new CursorLoader(context, android.provider.Browser.BOOKMARKS_URI, projection, null, null,
null);
cursor = cursorLoader .loadInBackground();
Other modification is , you don't need to call reQuery in honeyComb. You have LoaderManager callbacks are there in honeyComb. That will be called if there is any change in the underlying data.
For implementing LoaderManager callbacks
- First implement the interface in your class as LoaderManager.LoaderCallbacks
- in onCreate you need to initialize the loader as
getLoaderManager().initLoader(0, null, this);
- for reQuery, you can use, getLoaderManager().restartLoader(0, null, this);
- Then you need to override three methods in it as,
- onCreateLoader()
- onLoadFinished()
- onLoaderReset()
Static variables in your Android Application
Instead of declaring static variables in an activity you can also do it in your own subclass of the Activity class, which is a singleton.
Within strings.xml I have the application version.
I didn't want to store this value second time as a constant in my java code. And here is the solution.
Within strings.xml I have the application version.
<
resources
>
<
string
name
=
"version_name"
>2.0.0</
string
>
</
resources
I didn't want to store this value second time as a constant in my java code. And here is the solution.
public class MyApp extends Application { private static String appVersion = "" ; public static void setAppVersion (String version) { appVersion = version; } public static String getAppVersion () { return appVersion; } } In my first activity I initialize version variables: public void onCreate(Bundle savedInstanceState) { ... String appVersion = this .getString(R.string.version_name); MyApp.setAppVersion(appVersion); ... } Now version value can be read everywhere in your application also in normal java classes: |
...
String version = MyApp.getEasyGOVersion();
...
Try this :)
Android World: Video streaming using RTSP in android
Android World: Video streaming using RTSP in android: public class VideoViewDemo extends Activity { private static final String TAG = "VideoViewDemo"; private VideoView mVideoView; private E...
Wednesday, 6 July 2011
Video streaming using RTSP in android
public class VideoViewDemo extends Activity {
private static final String TAG = "VideoViewDemo";
private VideoView mVideoView;
private EditText mPath;
private ImageButton mPlay;
private ImageButton mPause;
private ImageButton mReset;
private ImageButton mStop;
private String current;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mVideoView = (VideoView) findViewById(R.id.surface_view);
mPath = (EditText) findViewById(R.id.path);
//mPath.setText("http://daily3gp.com/vids/747.3gp");
mPath.setText("rtsp://v3.cache1.c.youtube.com/CjgLENy73wIaLwkEj-R-63EflhMYESARFEIJbXYtZ29vZ2xlSARSB3JlbGF0ZWRgvJG0icWC58hNDA==/0/0/0/video.3gp");
mPlay = (ImageButton) findViewById(R.id.play);
mPause = (ImageButton) findViewById(R.id.pause);
mReset = (ImageButton) findViewById(R.id.reset);
mStop = (ImageButton) findViewById(R.id.stop);
mPlay.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
playVideo();
}
});
mPause.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (mVideoView != null) {
mVideoView.pause();
}
}
});
mReset.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (mVideoView != null) {
mVideoView.seekTo(0);
}
}
});
mStop.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (mVideoView != null) {
current = null;
mVideoView.stopPlayback();
}
}
});
}
private void playVideo() {
try {
final String path = mPath.getText().toString();
System.out.println("path "+path);
Log.v(TAG, "path: " + path);
if (path == null || path.length() == 0) {
Toast.makeText(VideoViewDemo.this, "File URL/path is empty",
Toast.LENGTH_LONG).show();
} else {
System.out.println("else ");
// If the path has not changed, just start the media player
if (path.equals(current) && mVideoView != null) {
System.out.println("mVideoView.start() ");
mVideoView.start();
mVideoView.requestFocus();
return;
}
current = path;
mVideoView.setVideoURI(Uri.parse(path));
mVideoView.start();
mVideoView.requestFocus();
}
} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
if (mVideoView != null) {
mVideoView.stopPlayback();
}
}
}
private static final String TAG = "VideoViewDemo";
private VideoView mVideoView;
private EditText mPath;
private ImageButton mPlay;
private ImageButton mPause;
private ImageButton mReset;
private ImageButton mStop;
private String current;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mVideoView = (VideoView) findViewById(R.id.surface_view);
mPath = (EditText) findViewById(R.id.path);
//mPath.setText("http://daily3gp.com/vids/747.3gp");
mPath.setText("rtsp://v3.cache1.c.youtube.com/CjgLENy73wIaLwkEj-R-63EflhMYESARFEIJbXYtZ29vZ2xlSARSB3JlbGF0ZWRgvJG0icWC58hNDA==/0/0/0/video.3gp");
mPlay = (ImageButton) findViewById(R.id.play);
mPause = (ImageButton) findViewById(R.id.pause);
mReset = (ImageButton) findViewById(R.id.reset);
mStop = (ImageButton) findViewById(R.id.stop);
mPlay.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
playVideo();
}
});
mPause.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (mVideoView != null) {
mVideoView.pause();
}
}
});
mReset.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (mVideoView != null) {
mVideoView.seekTo(0);
}
}
});
mStop.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
if (mVideoView != null) {
current = null;
mVideoView.stopPlayback();
}
}
});
}
private void playVideo() {
try {
final String path = mPath.getText().toString();
System.out.println("path "+path);
Log.v(TAG, "path: " + path);
if (path == null || path.length() == 0) {
Toast.makeText(VideoViewDemo.this, "File URL/path is empty",
Toast.LENGTH_LONG).show();
} else {
System.out.println("else ");
// If the path has not changed, just start the media player
if (path.equals(current) && mVideoView != null) {
System.out.println("mVideoView.start() ");
mVideoView.start();
mVideoView.requestFocus();
return;
}
current = path;
mVideoView.setVideoURI(Uri.parse(path));
mVideoView.start();
mVideoView.requestFocus();
}
} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
if (mVideoView != null) {
mVideoView.stopPlayback();
}
}
}
Subscribe to:
Posts (Atom)