First of all Happy Diwali to all my friends and fans.
In this article we are learning the new android API concept that delete the multiple row item of the list view. Before we have knowledge about the delete the row item with the help of check box. But in new API-18 have provide the features to delete the multiple row item from the list-view without the check-box uses.
This feature is available inside the contextual action mode in higher android version 3.0. So here question is what is contextual action mode? The contextual action mode is a system implementation of ActionMode that focuses user interaction toward performing contextual actions. When a user enables this mode by selecting an item, a contextual action bar appears at the top of the screen to present actions the user can perform on the currently selected item(s). While this mode is enabled, the user can select multiple items (if you allow it), deselect items, and continue to navigate within the activity (as much as you're willing to allow). The action mode is disabled and the contextual action bar disappears when the user deselects all items, presses the BACK button, or selects the Done action on the left side of the bar.
This event happen when the user performs a long-click on the view. Contextual actions on groups of items in a ListView or GridView (allowing the user to select multiple items and perform an action on them all). More details about this contextual menu. and MultiChoiceModeListener.
This tutorial might be helpful for leaning about the Alarm with Broadcast Receiver in android. A Broadcast Receiver is an Android component which allows you to register for system or application events. All registered receivers for an event will be notified by the Android run-time once this event happens.
A BroadcastReceiver object is only valid for the duration of the call to onReceive(Context, Intent). Once your code returns from this function, the system considers the object to be finished and no longer active.
If registering a receiver in your Activity.onResume() implementation, you should unregistered it in Activity.onPause(). (You won't receive intents when paused, and this will cut down on unnecessary system overhead). Do not unregistered in Activity.onSaveInstanceState(), because this won't be called if the user moves back in the history stack. More detail about broadcast receiever Here.
Alarm Manager class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running. Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.
The Alarm Manager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing. This guarantees that the phone will not sleep until you have finished handling the broadcast. Once onReceive() returns, the Alarm Manager releases this wake lock. This means that the phone will in some cases sleep as soon as your onReceive() method completes.
There are two way we can registered and unregistered the broadcast receive. 1. Dynamic way 2. Static Way
Dynamic way:-
You can register a receiver dynamically via the Context.registerReceiver() method. You can also dynamically unregister receiver by using Context.unregisterReceiver() method.
Static Way:-
You can use thePackageManager class to enable or disable receivers registered in your AndroidManifest.xml file.
In this tutorial we are sharing the code to insert the image into db and retrieve the image from db. I hope this article might be helpful to all learning developer.
SQLite is really a quick and compact android database technology which incorporates SQL syntax to create queries and also handle data.
Android SDK by itself provides the SQLite support which without doubt making the setup as well as utilization process within our applications with no trouble.
Whenever we make use of an Android SQLite Database all of us undoubtedly require the help of SQLiteOpenHelper to handle our data.SQLiteOpenHelper is surely an superb destination to place some initial values right into the android sqlite database when it is built.
For storing the image we are using the blob type. Blob is a Java interface representing the SQL BLOB type. An SQL BLOB type stores a large array of binary data (bytes) as the value in a column of a database. The java.sql.Blob interface provides methods for setting and retrieving data in the Blob, for querying Blob data length, and for searching for data within the Blob. More details about Blob Here
But i think in big level storing the image in database is not valuable because database sqlite have limited space so store the image path is valuable.
I hope this tutorial and article might be helpful for all android developer to make a multiple payment with this new android sdk pay pal in app. PayPal announced a new Android SDK that tries to make it easier for developers to accept in-app payments on Google�s mobile platform. As expected, the Android payments solution accepts both PayPal and credit card payments. The company says it is quick and easy to use, and �removes payment friction so developers can focus on creating amazing experiences.�
PayPal�s strategy is to make it as easy as possible for mobile developers to integrate its payments into their work. The pitch is simple: if consumers don�t have to leave your app to pay, and they can do so in more ways than one (click a PayPal button or scan a credit/debit card), they will be more likely to do so.
The new PayPal Android SDK supports Android version 2.2 and up. The new Android payment solution will allow developers to accept payments via PayPal and via credit cards. PayPal believes that giving users the option to pay quickly and easily via their PayPal account or by scanning a credit card will lure more customers into paying developers for their work.
PayPal says that it is also offering security features that will allow developers to �significantly reduce� fraud they encounter with payments. So I think that its really amazing concept for android developer. More in detail visit the pay pal developer site and git-hub repository Pay Pay Developer.
// set to PaymentActivity.ENVIRONMENT_LIVE to move real money. // set to PaymentActivity.ENVIRONMENT_SANDBOX to use your test credentials from https://developer.paypal.com // set to PaymentActivity.ENVIRONMENT_NO_NETWORK to kick the tires without communicating to PayPal's servers. private static final String CONFIG_ENVIRONMENT = PaymentActivity.ENVIRONMENT_NO_NETWORK;
// note that these credentials will differ between live & sandbox environments. private static final String CONFIG_CLIENT_ID = "credential from developer.paypal.com"; // when testing in sandbox, this is likely the -facilitator email address. private static final String CONFIG_RECEIVER_EMAIL = "matching paypal email address";
// It's important to repeat the clientId here so that the SDK has it if Android restarts your // app midway through the payment UI flow. intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, "credential-from-developer.paypal.com"); intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "your-customer-id-in-your-system"); intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, 0); }
@Override protected void onActivityResult (int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION); if (confirm != null) { try { Log.i("paymentExample", confirm.toJSONObject().toString(4));
// TODO: send 'confirm' to your server for verification. // see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ // for more details.
} catch (JSONException e) { Log.e("paymentExample", "an extremely unlikely failure occurred: ", e); } } } else if (resultCode == Activity.RESULT_CANCELED) { Log.i("paymentExample", "The user canceled."); } else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) { Log.i("paymentExample", "An invalid payment was submitted. Please see the docs."); } }
I hope this tutorial might be helpful to all android developer to search or filter the item of the custom list view. Here the list view which shows in Alert-dialog. And we can search the item of the list view.
Here I am creating the ListView and Editext programatically and search the item of the list view. So lets start the coding to search the item of the listview in alert dialog.
txt_item=(EditText)findViewById(R.id.editText_item); btn_listviewdialog=(Button)findViewById(R.id.button_listviewdialog); btn_listviewdialog.setOnClickListener(this); } @Override public void onClick(View arg0) {
AlertDialog.Builder myDialog = new AlertDialog.Builder(MainActivity.this);
final EditText editText = new EditText(MainActivity.this); final ListView listview=new ListView(MainActivity.this); editText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.discoverseed_larg1, 0, 0, 0); array_sort=new ArrayList (Arrays.asList(TitleName)); LinearLayout layout = new LinearLayout(MainActivity.this); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(editText); layout.addView(listview); myDialog.setView(layout); CustomAlertAdapter arrayAdapter=new CustomAlertAdapter(MainActivity.this, array_sort); listview.setAdapter(arrayAdapter); listview.setOnItemClickListener(this); editText.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s){
} public void beforeTextChanged(CharSequence s, int start, int count, int after){
} public void onTextChanged(CharSequence s, int start, int before, int count) { editText.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); textlength = editText.getText().length(); array_sort.clear(); for (int i = 0; i < TitleName.length; i++) { if (textlength <= TitleName[i].length()) {
Android it�s very easy to set the time using the android.widget.TimePicker component. In this tutorial we are going to see how the user can select the hour, and the minute using the android.app.TimePickerDialog which is an easy to use the dialog box.
In this tutorial I am creating the custom Time Picker with minute interval 00-15-30-45.
So lets start the coding to create the custom time picker in android.