If you’re migrating from the
RecyclerView in API Level 21 support library (i.e. Android 5.0 / Lollipop), you may be wondering how to add a click listener for entries in the list. With the
ListView you would provide a single listener for all list entries using the
ListView.setOnItemClickListener() method, which takes an implementation of the
AdapterView.OnItemClickListener interface as its parameter. In your implementation of this interface you would override the
onItemClick() method where you are given the ListView instance, the View for the entry in the list, its position, and ID as method parameters.
The stumbling block with the
RecyclerView is that it does not have this
setOnItemClickListener() method. The solution is actually quite simple, you can use the standard
setOnClickListener() method provided by the
View object. You can do this for the
View objects corresponding to each list entry.
You would typically inflate the required
View object from the respective resource definition in your override of the
RecyclerView.Adapter.onCreateViewHolder() method. You would also construct your version of the
RecyclerView.ViewHolder class there and pass the inflated
View object as a constructor parameter.
View.setOnClickListener() accepts a
View.OnClickListener implementation as its parameter, and your ViewHolder is a good place to implement this. This is because the ViewHolder class has access to the list entry View object, its parent, position, and ID which are exactly the same as the parameters you were provided in the old ListView
Your ViewHolder class could look something like the following:
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
protected ViewHolder(View v)
// Inflate all your UI elements for the list entry ..
// and ...
public void onClick(View v)
int pos = this.getPosition();
long id = this.getItemId();
ViewParent parent = v.getParent();
And that’s really it! The code above should provide a good start for your ViewHolder class. Hopefully this has been helpful.
For the first time Apple released the external blueprints of one of their devices to the public. Usually this is made available to accessory manufacturers. Now they’ve published it in their developer site.
Samsung can now start making its next phone. (I keeeed! I keeeed! 😀)
Google just published the monthly Android platform distribution. It shows that Android version 4.0 (ICS) has been growing at the same pace as last month, and version 4.1 (Jelly Bean) is just about getting a foothold in the market.
|Ice Cream Sandwich
||14 – 15
||12 – 13
||9 – 10
ICS usage share got a bit of a boost from the upgrades as well as some of the new phones. In next months statistics, we should see some of this boost shift to Jelly Bean if the most popular phone right now e.g. the Samsung Galaxy S3 gets upgraded. Along with other phones due for release this may put Jelly Bean at nearly 10%. or at least I hope! Otherwise the Jelly Bean share should hover around 2% while the ICS share rises to the mid-20%.
We’re unlikely to see the Gingerbread usage share decrease any quicker then the current rate as the phones still on this version are bound to stay on it. This will just get diluted as new phones come to market, and old phones are discarded.
Carrier IQ is a spyware program for mobile phones that has been in the news a fair amount in recent weeks. It is able to record many things including the list of installed apps, the location of the device, buttons pressed including keystrokes on the soft keyboard, and the content of messages. This data is sent to the Carrier IQ servers and then onto the mobile service provider which can be used for generating statistics or further relayed onto third parties such as advertisers, and law enforcement. This program cannot be uninstalled without rooting the phone.
While service providers and Carrier IQ claim that they do not store the content of messages, it has been found that they are infact doing this. They claim that this is a bug, and they are working on a fix.
Currently in the US, AT&T and T-Mobile include this program in their phones, while Verizon has made clear that they do not use it.
From an alleged T-Mobile document it appars that the following phones contain Carrier IQ:
- HTC Amaze 4G
- Samsung Galaxy S II
- Samsung Exhibit II 4G
- T-Mobile myTouch by LG
- T-Mobile myTouch Q by LG
- LG DoublePlay
- BlackBerry 9900
- BlackBerry 9360
- BlackBerry 9810
So, I’d steer clear of any of those phones on AT&T or T-Mobile if I were you. (In fact I’d steer clear of those networks alltogether! :p)
Mobile operators in the UK do not use Carrier IQ.
via: The Verge
The smartphone market is finally getting a full-fledged flash player. Adobe’s CTO Kevin Lynch demonstrated Flash 10 running on Nokia Series 60 (based on Symbian), Windows Mobile and even the Google Android platforms. There was a major but expected absentee … The iPhone.
The smartphone market is finally getting a full-fledged flash player. Adobe CTO Kevin Lynch demonstrated Flash 10 running on Nokia Series 60 (based on Symbian), Windows Mobile and even the Google Android platforms. There was a major but expected absentee … The iPhone.
While Adobe has a near complete version for the iPhone, it’ll probably never be released to the wild. The problem as some see it is that it is too close for comfort for Apple, providing a free application platform that would compete with the App Store. They would lose the tight control they have on what can be run on an iPhone, as well as losing the revenue stream from sales via the App Store.
Continue reading “Flash and the mobiles”
Minimo – Mozilla’s mobile browser project has been cancelled.
It appears that Minimo – Mozilla’s mobile browser project has been scrapped. Despite of being slimmed down, it was still quite slow on windows mobile. I guess that’s the reason for it meeting its demise.