Android Widget OnClick Example

Open link in browser after user do click on widget area:

private Context _context;
	@Override
		public void onStart(Intent intent, int startId) {
                        _context = this;
			String definePage ="http://old.chmi.cz/meteo/rad/rad_data.php";
			 Intent defineIntent = new Intent(Intent.ACTION_VIEW,
			 Uri.parse(definePage));
			 PendingIntent pendingIntent = PendingIntent.getActivity(_context,
			 0 /* no requestCode */, defineIntent, 0 /* no flags */);
			 updateViews.setOnClickPendingIntent(R.id.widget, pendingIntent);
This entry was posted in Android Examples Code and tagged , . Bookmark the permalink.


Comments are closed.



3,289 views