public boolean enableWIFI()
{
WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
if(wifiManager.isWifiEnabled()){
if(wifiManager.setWifiEnabled(false))
return true;
}else{
if(wifiManager.setWifiEnabled(true))
return true;
}
return false;
}
Archive for the ‘Google’ Category
We can search for a particular from Address in email as follows :
from:mymail@mydomain.com
Example :
from:mymail@mydomain.com — will search and show the emails from mymail@mydomain.com.
Stephan Ritter and his colleagues at the Max Planck Institute of Quantum Optics, in Garching, Germany, have constructed an elementary quantum network with two nodes. They say it is a proof of concept that could one day be extended to create large-scale quantum information networks that guarantee the security of message transmission by encoding data using the quantum state of photons.Quantum information networks are a subject of scientific fascination because they are not susceptible to eavesdropping. First described in 1984 by Charles Bennett of IBM and Gilles Brassard of the University of Montreal,quantum cryptography—which relies on the transfer of information encoded in the quantum states of photons—is considered by many to be the ultimate unbreakable code.
visit :http://spectrum.ieee.org/telecom/internet/path-clears-toward-a-quantum-internet for more details
Malware disguised as Instagram has been found online. It is getting distributed through Android downloads.
An IT firm, Sophos, has discovered fake versions of the popular photo sharing app and Angry Birds online. It has detected malware, which is being distributed on a Russian website pretending to be an official Instagram website, as Andr/Boxer-F.
Google Play, the Android market place is the official site for any such downloads. But, if the Android users download the app from an unapproved source, they may get their devices severely effected by the malware.
The Android way of delegating actions to other applications is to invoke an Intent that describes what you want done. This process involves three pieces: The Intent itself, a call to start the external Activity, and some code to handle the image data when focus returns to your activity.
Here’s a function that invokes an intent to capture a photo.
private void dispatchTakePictureIntent(int actionCode) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent, actionCode);
}
With this code, your application gains the ability to make another camera application take photos. Make sure that there is a compatible application ready to catch the Intent.
Function to check whether an app can handle your intent:
public static boolean isIntentAvailable(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
Many of today’s most popular smartphones can be erased from afar if they’re misplaced or fall into the wrong hands. Here’s how to do it.
Our phones are valuable, but they’re easily replaced. The data on them, however, is often much more important. Cell phones carry all kinds of personal and business information these days, so preventing them from getting in the wrong hands is key.
All of the major smartphone platforms have some kind of remote erase capability. There are several ways of doing it, such as installing apps on the handset, using a management console on the IT side, or signing up for a cloud-based service. Here’s a rundown of what’s out there for each platform. No matter which smartphone OS you or your employees use, you’re bound to find something that can help put your mind at ease.
The same features that enable the remote disable can also just be used to find the phone. Most of today’s smartphones have some form of GPS capability. That means you can use the same tools just to find or locate the lost phone in the first place—and potentially, depending on who has it, or where it’s found, get it back.
Though it varies by platform, the remote wipe solutions listed below—or any for that matter—aren’t fail-safe. If someone finds the phone before the remote wipe occurs—which could happen if the battery dies, or there’s no signal to receive the command—a thief or corporate spy could disable the network connections and then hack away. Your best insurance, therefore, is to disable the handset as quickly as possible, the same way you would call your credit card company the moment you noticed a credit card was missing.
Apple iPhone
You can now locate and remotely erase any iPhone. While you still have the device, head to Settings > iCloud and turn on Find My iPhone if it isn’t already enabled. If you lose your phone, you can find it either by installing the free ‘Find My iPhone’ app on another iOS device, or by visiting icloud.com, signing in, and using Apple’s Web-based ‘Find My iPhone’ app. With either tool, you can remotely lock the phone with a passcode if you haven’t already, send a message to it, play a sound, or remotely wipe the phone.
Google Android
‘Android Lost’ adds remote find and wipe capability, and also lets you set a password and lock the SIM card slot. You can even sound an alarm when the phone is on silent—perfect for finding it when it’s buried in the couch cushions. We’re particularly fond of Android Lost because you can push the app to the phone from Google Play (formerly the Android Market) remotely. In a corporate setting, IT managers deploying Android devices can enable native remote wipe capability by installing ‘Google Apps Device Policy’, though it can’t be added retroactively.
Microsoft Windows Phone
For any Windows Phone 7 or 7.5 device, head to www.windowsphone.com on a desktop or laptop PC and sign in. Then click My Phone. From here, you can locate the phone with GPS, erase all the data, lock the phone and display a message, or change your password. Microsoft also lets you set the phone itself to save its location every few hours; this helps if you lose the phone later and the battery dies, since it will have reported its last known location. To do so, head to Start > App List > Settings and tap Find My Phone.
RIM BlackBerry OS
Research In Motion offers ‘BlackBerry Protect’, a free app that lets you find, lock, or wipe your BlackBerry from a remote location. It also adds daily, weekly, and monthly backup capability for your data. Any BlackBerry Enterprise Server (BES) handset can be erased remotely via the ‘Erase Data and Disable Handheld’ IT administration command over the wireless network. IT admins can also specify if the handset should revert to factory default settings or retain the IT policy it had before.
Intents are just what they sound like, a way to declare to the Android Framework what you intend to do. This can be starting a specific activity, or it can be just asking Android to find some program that can perform an action (whether or not you know what programs are available). We can also go in the other direction, and determine what actions are available to us for a particular piece of content. We are going to cover each of these topics in this article.
Here is the basic ListActivity example.
package com.learnandroid.intents;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
public class UsingIntentsActivity extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ListAdapter adapter = createAdapter();
setListAdapter(adapter);
}
protected ListAdapter createAdapter()
{
String[ ] listValues = new String[ ] {
"The Activity You Know",
"The URI You Know",
"When You Just Don't Know"
};
// Create a simple array adapter (of type string) with the test values
ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1
, listValues);
return adapter;
}
}
Adapters in Android
An adapter is how Android translates data from some data source onto a view. Typically adapters are used on ListViews and GridViews, and Android provides some very helpful adapters out of the box.
The adapter goes hand-in-hand with a corresponding view (which in our case is a ListView.) Together they bring cleaner code, optimized performance, and reusability to your project.
Cleaner separation of concerns
When you add an object to an adapter, the action also adds the representative view for that object to any lists bound to the adapter. Your code that is adding data into the list through the adapter doesn’t have to know how the list is built for each item. Likewise, the code that knows how to build views for each item in your list doesn’t have to know where the data is coming from.
This makes a somewhat clean separation of concerns that normally overlap in one spot. Those of you who have written many lines of code to populate UI elements with varied data can understand how tangled the project becomes when the code retrieving data is also the code rendering it.
Optimizations: View Recycling
Another great benefit of using a ListView/adapter is the immense performance gains it can bring. If you’ve ever built a ScrollView with a list of child views, you’ll notice that performance becomes slow quickly. The ListView/adapter pair solves this with a traditional technique: view recycling.
View recycling is a technique in which view objects are re-used once their current locations are no longer visible. This has a great performance advantage– as your list of items grows, the total number of views remains the same, which corresponds to the distinct number of views drawn in a single screenful. Even better yet, the process is handled behind the scenes, so your adapter should only be aware that views are reused, not necessarily how they are reused.
Code Reusability
Finally the code you write for an adapter, and the separation it forces in the data, view, and adaptation concerns, will result in your code being much more reusable. Where you may have previously written all of the code directly into some Activity for displaying a list of complex objects, now you have a separate class that you can reuse for other lists. In fact, you can even vary the layout the adapter uses without changing anything about the adapter itself.
This example requires three basic classes in order to implement a basic game. The game logic can be extended or changed and the resources can be replaces easily using the same patterns. The file DrawablePanel.java contains the code for DrawablePanel which extends SurfaceView and provides a full screen canvas. The DrawablePanel contains an AnimationThread. This class extends Thread (you could also provide a runnable, whatever pattern is more familiar). The AnimationThread class holds a reference to the DrawablePanel described above and updates the DrawablePanel for game logic and forces a redraw of the panel.
STS Validator
The eight STS validator options are project-wide validation rules.
These validators are disabled by default.
| STS Rule | Description |
| Driver Manager Data Source | Validates the project does not use this class |
| Bean Inheritance | Recommends bean inheritance for simplification |
| Import Elements at Top | Recommends imports before other bean definitions |
| Parent Beans not Abstract | Validates that parent beans are not abstract |
| Too Many Beans | Validates too many beans in file – approx. 80 beans |
| Unnecessary Ref | Check for ref elements and recommends ref attribute instead. <property … ref=””/> instead of <property …><ref bean=””/></property> |
| Dedicated Namespace Syntax | Checks for cases where dedicated namespaces can be used
|




