|
As explained in the docs.
Which language would you want it in? There's examples available for each viable answer, and I happily Google them for you.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi everybody,
I am a newbie to XAMARIN and working in XAMARIN (VS-2019) on a sample android app to connect to an SQL Server 2014 database to perform CRUD actions using direct ADO SqlClient connection, and did all remote connection configurations on my server such as: Enabling TCP/IP - Setting Exception rules on the Firewall (1433 for TCP and 1434 for UDP - Program Exception for SQL Server, and Program exception for SQL Browser), so all fine.
Actually my application seemed to be working on the emulator on debug, but not when published on a real android device, my application just ignores my request and goes back to the Main activity.
Could someone help me out please so this is my code:
public void InsertUser()
{
try
{
string dbstring = @"data source=xxx.xx.xx.xx,1433;initial catalog=MyDatabase;user id=XamarinUser;password=myPassword;Connect Timeout=10";
SqlConnection Con = new SqlConnection(dbstring);
if (Con.State == ConnectionState.Open) { Con.Close(); }
Con.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO tblUSERS (Username, Password, Email, Active) VALUES ('" + txtUserName.Text + "','" + password1.Text + "','" + txtEmail.Text + "',0);", Con);
cmd.ExecuteNonQuery();
Con.Close();
Con = null;
cmd = null;
this.Dismiss();
}
catch (Exception)
{
throw new Exception("Application run into errors. Please contact us.");
}
}
modified 28-Apr-20 12:34pm.
|
|
|
|
|
|
|
Hello everyone, I am a new android user, I want to do my project with undo and redo buttons for edit text, I don't know what to do? please help me! thanks
|
|
|
|
|
Start with something less complicated and learn the different features of Android programming. Leave the advanced projects until you are full skilled with the basics.
|
|
|
|
|
Hello my dear friends . How can I get the geographic coordinates in which I am offline? Thank you for your reply.
|
|
|
|
|
|
hi !
I have a small win32 (18k) app that i developed years ago for my electronic hobby project. Basically, it takes the text from the screen or from a file, stores it internally in arrays and writes at regular time intervals data packets to the COM1 port(as a file). On windows and linux(using wine) on my PC i used a virtual COM port and installed a driver for a rs232 to usb adapter(ft232 chipset). I want the same on android. The win32 app was written in C, the only language i know, and i would like to port the app "as is"(no code rewriting) to android, because i have no clue of android programming at all. The search on the internet returned no results - i didn't find any solution. Is the following way possible :
General : Installing a minimal linux distro on android with usb acces/ Installing FT232 driver in the terminal
1.compiling the code for arm(32) linux/ Run it in the terminal
Or
2. Port the exe to windows rt/arm / Run the .exe with wine in the terminal ?
The linux distros in the android app(userland, andronix) are bare-bone ones and do not seem to provide usb support( when i run lsusb i get -99 code error) I've also installed visual studio 2019 (win 10 SDK) and cannot build my project because .h files are not found, even if i change the path in the project properties. If i enter the complete path in my code file they are found, but then i still have 200 error messages because things like Bool, Handle, are not defined. The original/initial application i build 10 years ago was generated by CodeBlocks on my old PC which i dont have anymore(broken,but i still have all original project files).
The project files can be found here (link temporary available for your analisys and answers): https:
Thanks.
|
|
|
|
|
Hello everyone.
I’ve decided to program Android in IntelliJ IDEA 2018.3 using Kotlin.
When I determine the SDK path and create the Android project, I face the "MyProject sync faild" message. Furthermore I am using JDK 8.
The errors shown to me are:
Could not find com.android.tools.build:gradle:3.1.0.
Searched in the following locations: https:
https:
https:
https:
Required by:
project :
Add Google Maven repository and sync project
Open File
Please help me.
Thank you.
|
|
|
|
|
Just proceed with intellij suggestion to "Add google maven repository" via popup shown at right bottom or add these to your project root build.gradle file.Located at ../project_root/build.gradle.
repositories
{
google()
jcenter()
maven { url "https://jitpack.io" }
}
|
|
|
|
|
Thank you, but it doesn't work.
|
|
|
|
|
can you post a link of that error as screenshot here.
|
|
|
|
|
|
|
Hey,I want a text box that take value from other device via Bluetooth. For example,
when a person ,measures blood glucose level from a Bluetooth embedded device(Glucometer), the value should appear on that text box of android app.<pre>
|
|
|
|
|
Hey back.
Fine.
What do you want us to do about that?
|
|
|
|
|
See if this article gives you some ideas.
"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
|
|
|
|
|
Hello everybody, i would like to thank the community here and the writers of the articles here for their help in android programming,
From the first articles about Xamarin.Android here i have start learning coding with the articles of Dominic Burford - Professional Profile[^] and in the last days Eddy Vluggen (and others if im not mistaken) was really helpful.
My child is the application Simple User Feedback that you can find on Google Play, its a simple application to gather emotional feedback from your audience, it displays some images with face expressions that you click according with the input you want to give, positive or negative, or something else.
Tell me how do you find it
|
|
|
|
|
Exoskeletor wrote: Tell me how do you find it
Hey there,
If you are sharing a free tool with the community for feedback, or just for the fun of it (obviously, no malware/spam) then I recommend you post it at Free Tools Discussion Boards and let the community know.
This part of the forum is for questions related to Android development.
Oh, congratulations on your applications! Why don't you write an "experience" article on CodeProject, I am sure everybody would enjoy a good read.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hello friend, the free tolls section says that we can post tools there that are for software development, my tools are for businesses mostly, can i post it there?
|
|
|
|
|
Im making an application that i want to have the ability to send report emails with a frequency. daily, weekly or monthly.
Now i want those emails to be sent only if the app is running and if the user is using it (in my app you use the mobile as a kiosk, you open the app and leave it running all the time, screen will not close)
I have write this code in the MainActivity where if someone has enabled the frequently email feature, the activity will try to send the email (SendStatisticsToEmailBySchedule() will run forever and will use SendStatisticsToEmail() from time to time to send an email):
public async void SendStatisticsToEmail(string subject, string address, int port, string from, string to, bool useSSL, bool saveDateSent = false, string username = "", string password = "", bool sendNowButtonUsed = false)
{
var fileName = System.IO.Path.Combine(
GetString(Resource.String.Statistics_ExportAllExportPrefix,
firstResult.ToString("MM-dd-yyyy"),
DateTime.Today.ToString("MM-dd-yyyy")));
var message = new MimeMessage();
message.From.Add(new MailboxAddress(from));
message.To.Add(new MailboxAddress(to));
message.Subject = subject + " " + fileName;
var statistics = new Statistics();
var reportsForXML = statistics.ConvertRecordsForExport(MyData);
MemoryStream stream = new MemoryStream();
var builder = new BodyBuilder();
var image = BitmapFactory.DecodeResource(Resources, Resource.Drawable.get_started);
byte[] imgbyte;
using (var bitmap = image)
{
var streamByte = new MemoryStream();
bitmap.Compress(Bitmap.CompressFormat.Png, 100, streamByte);
bitmap.Recycle();
imgbyte = streamByte.ToArray();
}
var imageAttach = builder.LinkedResources.Add(@"get_started.png", imgbyte);
imageAttach.ContentId = MimeUtils.GenerateMessageId();
builder.HtmlBody = string.Format(@"<p align=""center""><center><img height=""150"" width=""328"" src=""cid:{0}""></center></p><p align=""center"">{1}</p><p align=""center"">{2}</p><p align=""center"">{3}</p>", new object[] { imageAttach.ContentId, GetString(Resource.String.EmailExportSettings_MessageBodyLine1), GetString(Resource.String.EmailExportSettings_MessageBodyLine2), GetString(Resource.String.EmailExportSettings_MessageBodyLine3) });
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(stream))
{
reportsForXML.WriteXml(writer, XmlWriteMode.WriteSchema, false);
stream.Position = 0;
builder.Attachments.Add(fileName, stream);
}
message.Body = builder.ToMessageBody();
try
{
using (var client = new SmtpClient())
{
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
if (useSSL)
await client.ConnectAsync(address, port, SecureSocketOptions.SslOnConnect);
else
await client.ConnectAsync(address, port, false);
if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
client.Authenticate(username, password);
await client.SendAsync(message);
await client.DisconnectAsync(true);
if (saveDateSent)
{
Preferences.Set(Settings.ExportToEmailLastEmailSentKey, DateTime.Now);
ScheduleNextEmailForSend(DateTime.Now,
Preferences.Get(Settings.ExportToEmailEmailFrequencyPositionKey, Settings.ExportToEmailEmailFrequencyPositionDefault)
);
}
if (sendNowButtonUsed)
Toast.MakeText(this, GetString(Resource.String.Statistics_EmailSendSuccess), ToastLength.Long).Show();
}
}
catch
{
if (sendNowButtonUsed)
Toast.MakeText(this, GetString(Resource.String.Statistics_EmailSendFailure), ToastLength.Long).Show();
}
}
private async void SendStatisticsToEmailBySchedule()
{
do
{
if (MyData.Count != 0)
{
var currentConnectivity = Connectivity.NetworkAccess;
NextScheduledDateForReport = Preferences.Get(Settings.ExportToEmailNextEmailForKey, CurrentDateSettings.ExportToEmailNextEmailForDefault);
if (DateTime.Now > NextScheduledDateForReport)
{
if (currentConnectivity == NetworkAccess.Internet)
{
try
{
SendStatisticsToEmail(Preferences.Get(Settings.ExportToEmailSubjectKey, Settings.ExportToEmailSubjectDefault),
Preferences.Get(Settings.ExportToEmailServerAddressKey, Settings.ExportToEmailServerAddressDefault),
Preferences.Get(Settings.ExportToEmailPortKey, Settings.ExportToEmailPortDefault),
Preferences.Get(Settings.ExportToEmailFromKey, Settings.ExportToEmailFromDefault),
Preferences.Get(Settings.ExportToEmailToKey, Settings.ExportToEmailToDefault),
Preferences.Get(Settings.ExportToEmailUseSSLKey, Settings.ExportToEmailUseSSLDefault),
true,
Preferences.Get(Settings.ExportToEmailUsernameKey, Settings.ExportToEmailUsernameDefault),
Preferences.Get(Settings.ExportToEmailPasswordKey, Settings.ExportToEmailPasswordDefault)
);
}
catch
{
}
}
}
}
await Task.Delay(21600);
} while (true);
}
private void ScheduleNextEmailForSend(DateTime nextScheduledEmailDate, int frequency)
{
nextScheduledEmailDate = DateTime.Now;
frequency = Preferences.Get(Settings.ExportToEmailEmailFrequencyPositionKey, Settings.ExportToEmailEmailFrequencyPositionDefault);
switch (frequency)
{
case 0:
Preferences.Set(Settings.ExportToEmailNextEmailForKey, nextScheduledEmailDate.AddDays(1));
break;
case 1:
Preferences.Set(Settings.ExportToEmailNextEmailForKey, nextScheduledEmailDate.AddDays(7));
break;
case 2:
Preferences.Set(Settings.ExportToEmailNextEmailForKey, nextScheduledEmailDate.AddDays(30));
break;
}
}
From what i have read here https://developer.android.com/guide/components/services#Choosing-service-thread if you want to run some code only while the user is using your app, you should not use a service.
Is my code efficient?
Is there any situation that will stop working or should i somehow check that it is still working?
|
|
|
|
|
It is really nice that you wrote the message giving Thanks to the people here in CP.
Pity is I had to kill it, due to the link. It would be considered site driving and it is not allowed.
Please write the message again without the link and it will get through.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Please I just created an admob app but after installing it on my phone it keeps showing unfortunately, app has stopped when I try opening the app
|
|
|
|
|
Well that's unfortunate. Have you thought of checking the logs, using the debugger ... ?
|
|
|
|
|