Esempio n. 1
0
        public override RemoteViews getViewAt(int position)
        {
            // TODO Auto-generated method stub
            RemoteViews contentView  = new RemoteViews(mContext.PackageName, R.layout.widget_item);
            Bundle      extras       = new Bundle();
            Intent      fillInIntent = new Intent();

            if ((position % 2) == 0)
            {
                PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_DIAL), PendingIntent.FLAG_UPDATE_CURRENT);
                extras.putParcelable(Constants.EXTRA_CONTENT_INTENT, pIntent);
                fillInIntent.putExtras(extras);
                contentView.setOnClickFillInIntent(R.id.widget_item_layout, fillInIntent);
            }
            else
            {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.Type = "vnd.android-dir/mms-sms";
                PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
                extras.putParcelable(Constants.EXTRA_CONTENT_INTENT, pIntent);
                fillInIntent.putExtras(extras);
                contentView.setOnClickFillInIntent(R.id.widget_item_layout, fillInIntent);
            }
            try
            {
                contentView.setTextViewText(R.id.tv_item, mDbHelper.getData(position));
            }
            catch (System.IndexOutOfRangeException)
            {
            }
            return(contentView);
        }
		public override RemoteViews getViewAt(int position)
		{
			// TODO Auto-generated method stub
			RemoteViews contentView = new RemoteViews(mContext.PackageName, R.layout.widget_item);
			Bundle extras = new Bundle();
			Intent fillInIntent = new Intent();
			if ((position % 2) == 0)
			{
				PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_DIAL), PendingIntent.FLAG_UPDATE_CURRENT);
				extras.putParcelable(Constants.EXTRA_CONTENT_INTENT, pIntent);
				fillInIntent.putExtras(extras);
				contentView.setOnClickFillInIntent(R.id.widget_item_layout, fillInIntent);
			}
			else
			{
				Intent intent = new Intent(Intent.ACTION_VIEW);
				intent.Type = "vnd.android-dir/mms-sms";
				PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
				extras.putParcelable(Constants.EXTRA_CONTENT_INTENT, pIntent);
				fillInIntent.putExtras(extras);
				contentView.setOnClickFillInIntent(R.id.widget_item_layout, fillInIntent);
			}
			try
			{
				contentView.setTextViewText(R.id.tv_item, mDbHelper.getData(position));
			}
			catch (System.IndexOutOfRangeException)
			{

			}
			return contentView;
		}