|
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Hello Group
Now, I have a problem with a collection IList<>
My project use Web Service and the IList<> is fill with a web service, but when I try to delete one Item on IList<>, I get the error: Error Collection is of a fixed size. I have tried to fix this problem but I still can not. I need help !!!
namespace MobileApplication
{
public partial class ListaCriteriosAdapter : BaseAdapter<Criterio>
{
IList<Criterio> ListaCriterios;
private Context activity;
private LayoutInflater MiInflanter;
MobileService.MobileService Query = new MobileService.MobileService();
public ListaCriteriosAdapter(Context context, IList<Criterio> MiLista)
{
this.activity = context;
ListaCriterios = MiLista;
MiInflanter = (LayoutInflater)activity.GetSystemService(Context.LayoutInflaterService);
}
public override int Count
{
get { return ListaCriterios.Count; }
}
public override long GetItemId(int position)
{
return position;
}
public override Criterio this[int position]
{
get { return ListaCriterios[position]; }
}
public override View GetView(int position, View convertView, ViewGroup parent)
{
ContactsViewHolder Holder = null;
ImageView btnDelete;
if (convertView == null)
{
convertView = MiInflanter.Inflate(Resource.Layout.ListViewCriterios, null);
Holder = new ContactsViewHolder();
Holder.txtFolio = convertView.FindViewById<TextView>(Resource.Id.TVFolioListaCriterios);
Holder.txtCriterio = convertView.FindViewById<TextView>(Resource.Id.TVCriterioListaCriterios);
Holder.txtTipo = convertView.FindViewById<TextView>(Resource.Id.TVTipoListaCriterios);
btnDelete = convertView.FindViewById<ImageView>(Resource.Id.BTNBorrarCriterio);
btnDelete.Click += (object sender, EventArgs e) =>
{
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
AlertDialog Confirm = builder.Create();
Confirm.SetTitle("Confirmar");
Confirm.SetMessage("Estas seguro de eliminarlo?");
Confirm.SetButton("Aceptar", (s, ev) =>
{
var Temp = (int)((sender as ImageView).Tag);
int id = (Int32)ListaCriterios[Temp].IdCriterio;
ListaCriterios.RemoveAt(Temp);
EliminarCriterioPP((Int32)id);
NotifyDataSetChanged();
});
Confirm.Show();
};
convertView.Tag = Holder;
btnDelete.Tag = position;
}
else
{
btnDelete = convertView.FindViewById<ImageView>(Resource.Id.BTNBorrarCriterio);
Holder = convertView.Tag as ContactsViewHolder;
btnDelete.Tag = position;
}
Holder.txtFolio.Text = ListaCriterios[position].IdCriterio.ToString();
Holder.txtCriterio.Text = ListaCriterios[position].DescripcionCriterio.ToString();
Holder.txtTipo.Text = ListaCriterios[position].DescripcionGrafico;
NotifyDataSetChanged();
return convertView;
}
public class ContactsViewHolder : Java.Lang.Object
{
public TextView txtFolio { get; set; }
public TextView txtCriterio { get; set; }
public TextView txtTipo { get; set; }
}
private void EliminarCriterioPP(int Id)
{
Query.EliminarCriterioPPCompleted += Query_EliminarCriterioPPCompleted;
Query.EliminarCriterioPPAsync(Id);
}
void Query_EliminarCriterioPPCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
Toast.MakeText(activity, "Fue eliminado correctamente", ToastLength.Short).Show();
}
}
}
|
|
|
|
|
|
The MiLista parameter is a fixed size list - most likely an array.
You'll need to convert the parameter to a standard list. You can either do that unconditionally:
public ListaCriteriosAdapter(Context context, IEnumerable<Criterio> MiLista)
{
this.activity = context;
ListaCriterios = new List<Criterio>(MiLista);
MiInflanter = (LayoutInflater)activity.GetSystemService(Context.LayoutInflaterService);
}
Or, you can test the parameter to see if you need to convert it:
private static bool IsReadOnlyOrFixedSize<T>(IList<T> list)
{
if (list.IsReadOnly) return true;
var nonGenericList = list as System.Collections.IList;
return nonGenericList != null && nonGenericList.IsFixedSize;
}
public ListaCriteriosAdapter(Context context, IList<Criterio> MiLista)
{
if (IsReadOnlyOrFixedSize(MiLista))
{
MyLista = new List<Criterio>(MyLista);
}
this.activity = context;
ListaCriterios = MiLista;
MiInflanter = (LayoutInflater)activity.GetSystemService(Context.LayoutInflaterService);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good evening
I have implemented an application with auto update function. When I release new version on my server then application downloads new .apk and it starts an intent to install new .apk file.
I want to change this procedure, if it's possible. Before installing new version, I want that application should be able to uninstall itself.
How can I do?
Now I'm thinking to remove all file in Android system's folder reserved to this application, but is it a good way? What can you sugest me?
Thank you.
|
|
|
|
|
Quote: I have implemented an application with auto update function. When I release new version on my server then application downloads new .apk and it starts an intent to install new .apk file. That is required.
How about, you keep all of the business logic on your server side and just show the results on the Android application? This way, you won't have to push every fix to the Android application but merely the new features only.
Quote: Before installing new version, I want that application should be able to uninstall itself. That is done by default, your previous application is removed by the Google Play Store and then the latest version is installed. But if your application uninstalls itself then I am not sure, Google Play Store would be happy to install the new version of the application, without user intervention. It would require the user to go to Play Store and install the latest version themselves.
Quote: Now I'm thinking to remove all file in Android system's folder reserved to this application, but is it a good way? Of course, if the data is no longer of user, remove it.
Anyways, have a look here, there is way, where you can download the APK related content later, but that is just for the applications where the content is above 100 MB. APK Expansion Files | Android Developers[^]
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thank you for repaly. Last days I have made some tests. Now I can recal new intent to unistal my application, after downloading and storing new version in Download folder.
I have found the routine to send Intent for installing the new version.
Here is the code for this two procedures:
Uri packageURI = Uri.parse("package:com.example.nameapp");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivityForResult(uninstallIntent, PICK_CONTACT_UPDATE);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + nomeApp)), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
But when application executes unistallation, it is arrested and it cant't execute the install procedure (loading II intent).
How can I execute II intent after unistallation? Is it possible? How can I do?
|
|
|
|
|
Hi,everyone!!!!Can anyone tell me,or better show me ,how can I retrieve my contacts, shown into a list and when the user clicks on a contact to make a call????Please help.It is very important!!!!Everything i find is a bit old and doesnt work!Thank you all!!!!
|
|
|
|
|
Sorry, but this site does not provide code to order. You need to Google for samples and tutorials, or you could always try Android Developers[^].
|
|
|
|
|
Thank you very much for your reply,im a bit newbie and i have already do thiw but seems a bit confusing!
|
|
|
|
|
Member 12751865 wrote: i have already do thiw but seems a bit confusing! So what help do you need? Please be specific about your problem, otherwise we do not know how to help you.
|
|
|
|
|
Obviusly i didnt make it with that way...so i need more help in that project fully or partly...Never mind,I m going to find a way to do this.Thank you for your help!
|
|
|
|
|
I'm seeing four things here: 1) retrieve my contacts, 2) shown into a list, 3) respond to a click, 4) make a call. Stop looking at the larger picture and break it down into more manageable parts. Which of these specifically do you need help with?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Dear friend,
unfortunatelly i can not deal with any of these isues!If you have something on mind,pleaze help me,wherever you can.Thanks a lot for your kind response!!!
|
|
|
|
|
Member 12751865 wrote:
unfortunatelly i can not deal with any of these isues! So then exactly what are you doing here? This is, after all, a site for developer types.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I have developed an application in the Cordova Framework, and I have added a camera plugin for capture functionality.
I am getting an Information Leakage flaw in the code below
OutputStream os = this.cordova.getActivity().getContentResolver().openOutputStream(uri);
try {
bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os);
os.close();
} finally {
if (os != null) {
os.close();
}
}
|
|
|
|
|
Member 12358097 wrote: ...Information Leakage flaw...
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Is that a runtime exception or a compile-time? Can you share the exception name too?
Information leakage flaw is unclear. Share the error message, precise error message.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
here is the complete description by vera code,
Associated Flaws by CWE ID:
Information Exposure Through Sent Data (CWE ID 201)(5 flaws)
Description
Sensitive information may be exposed as a result of outbound network connections made by the application. This can manifest in a couple of different ways.
In C/C++ applications, sometimes the developer fails to zero out a buffer before populating it with data. This can cause information leakage if, for example, the buffer contains a data structure for which only certain fields were populated. The uninitialized fields would contain whatever data is present at that memory location. Sensitive information from previously allocated variables could then be leaked when the buffer is sent over the network.
Mobile applications may also transmit sensitive information such as email or SMS messages, address book entries, GPS location data, and anything else that can be accessed by the mobile API. This behavior is common in mobile spyware applications designed to exfiltrate data to a listening post or other data collection point. This flaw is categorized as low severity because it only impacts confidentiality, not integrity or availability. However, in the context of a mobile application, the significance of an information leak may be much greater, especially if misaligned with user expectations or data privacy policies.
Effort to Fix: 2 - Implementation error. Fix is approx. 6-50 lines of code. 1 day to fix.
Recommendations
In C/C++ applications, ensure that all struct elements are initialized or zeroed before being sent. In mobile applications, ensure that the transfer of sensitive data is intended and that it does not violate application security policy or user expectations.
|
|
|
|
|
That is the sort of detail that every developer is expected to understand; it just means that you need to be careful when handling sensitive data. And the solution will vary according to the structure of your actual application.
|
|
|
|
|
i understand and looking for solution.
if anyone can suggest i tried using try resource but no luck its giving same warning.
|
|
|
|
|
here is the complete code ,
Bitmap bitmap = null;
Uri uri = null;
if (destType == FILE_URI || destType == NATIVE_URI) {
if (this.saveToPhotoAlbum) {
Uri inputUri = getUriFromMediaStore();
try {
uri = Uri.fromFile(new File(FileHelper.getRealPath(inputUri, this.cordova)));
} catch (NullPointerException e) {
uri = null;
}
} else {
uri = Uri.fromFile(new File(getTempDirectoryPath(), System.currentTimeMillis() + ".jpg"));
}
if (uri == null) {
this.failPicture("Error capturing image - no media storage found.");
return;
}
if (this.targetHeight == -1 && this.targetWidth == -1 && this.mQuality == 100 &&
!this.correctOrientation) {
writeUncompressedImage(uri);
this.callbackContext.success(uri.toString());
} else {
bitmap = getScaledBitmap(FileHelper.stripFileProtocol(imageUri.toString()));
if (rotate != 0 && this.correctOrientation) {
bitmap = getRotatedBitmap(rotate, bitmap, exif);
}
try (OutputStream os = this.cordova.getActivity().getContentResolver().openOutputStream(uri)) {
bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os);
}
i tried using try resource but no luck still getting warning:
try (OutputStream os = this.cordova.getActivity().getContentResolver().openOutputStream(uri))
|
|
|
|
|
The message is telling you to look at the information you are transferring and take steps to keep it secure. If it does not need to be secured then you can ignore the warnings. If it does, then you need to use some form of encryption to protect it.
|
|
|
|
|
even i understand that but the issue is whats need to be done for this one line of code which is throwing warning , i can find inception point of warning and that is Uri .
what can we do with object( Uri uri) i am still way of finding solution.
try resource seems not be working.
Anyway thanks bro
|
|
|
|
|
The same answer as I have already given you.
|
|
|
|