Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
Articles: Android
Java Android Program to Demonstrate a Simple Compound Control
Java Android Program to Demonstrate Explicit Intent
Linkify is a helper class that creates hyperlinks within Text View (and Text View-derived) classes through RegEx(or Regular Expressions)pattern matching.
Text that matches a specified RegEx pattern will be converted into a clickable hyperlink that implicitly fires startActivity(new Intent(Intent.ACTION_VIEW, uri)),using the matched text as the target URI.
Java Android Program to Demonstrate Implicit Intent This Java Android Program demonstrates Implicit Intent. Here is source code of the Program to demonstrate Implicit Intent. The program is successfully compiled and run on a Windows system. The program output is also shown below.
To simply when a match corresponding to a defined pattern is found in the corresponding sentence the acceptMatch method is triggered which specifies which word are to convert into a hyperlink.
The Transform Filter lets you modify the implicit URI generated by matching link text. Decoupling the link text from the target URI gives you more freedom in how you display data strings to your users.
Here in this source code when a user clicks on either on GOOGLE or LINKIFY or SANFOUNDRY they all are converted to lower case when searching in web browser.
Broadcast Receivers (commonly referred to simply as Receivers) are used to listen for Broadcast Intents. For a Receiver to receive broadcasts, it must be registered, either in code or within the application manifest.
Broadcasting Intents helps make your application more open; by broadcasting an event using an Intent, you let yourself and third-party developers react to events without having to modify your original application. Within your applications you can listen for Broadcast Intents to to react to device state changes and third-party application events.
Android uses Broadcast Intents extensively to broadcast system events, such as changes in network connectivity, docking state, and incoming calls etc.
The PendingIntent class provides a mechanism for creating Intents that can be fired on your application’s behalf by another application at a later time. A Pending Intent is commonly used to package Intents that will be fired in response to a future event, such as a Widget or Notification being clicked.
When the order in which the Broadcast Receivers receive the Intent is important — particularly where you want to allow Receivers to affect the Broadcast Intent received by future Receivers — you can use sendOrderedBroadcast, as follows:
String requiredPermission = “com.example.package_name.MY_BROADCAST_PERMISSION”; sendOrderedBroadcast(intent, requiredPermission);
Using this method, your Intent will be delivered to all registered Receivers that hold the required permission (if one is specified) in the order of their specified priority. You can specify the priority of a Broadcast Receiver using the android:priority attribute within its Intent Filter manifest node, where higher values are considered higher priority.
The Local Broadcast Manager was introduced to the Android Support Library to simplify the process of registering for, and sending, Broadcast Intents between components within your application.
Because of the reduced broadcast scope, using the Local Broadcast Manager is more efficient than sending a global broadcast. It also ensures that the Intent you broadcast cannot be received by any components outside your application, ensuring that there is no risk of leaking private or sensitive data, such as location information.
Similarly, other applications can’t transmit broadcasts to your Receivers, negating the risk of these Receivers becoming vectors for security exploits.
To use the Local Broadcast Manager, you must first include the Android Support Library in your application, in order to do so open your sdk and locate Extras and click to download package Android Support Library.
To monitor changes in connectivity, register a Broadcast Receiver (either within your application or within the manifest) to listen for the android.net.conn.CONNECTIVITY_CHANGE (ConnectivityManager.CONNECTIVITY_ACTION) action.
Before you can access Internet resources, you need to add an INTERNET uses-permission node to
your application manifest, as shown in the following XML snippet:
In this example we are going to parse an Xml that we receive from the internet particularly from http://developer.yahoo.com/yql/console/ from here go to the bottom right corner in DATA TABLES and select Show Community Table and scroll dowm to yahoo and click on yahoo.finance.quote in the console that appears and type the following sql statement – select * from yahoo.finance.quote where symbol in (“MSFT”) , and uncheck Diagnostics and click on test ,