|
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 ... ?
|
|
|
|
|
Have you debug it? have you find which line breaks your app?
|
|
|
|
|
I need to convert one .csv file to Crypt 5 or Crypt 12, to transfer a backup of WhatsApp to an Android phone. Which programs should I use, in your opinion? Thank you.
|
|
|
|
|
You have already posted this in QA:
File .csv to crypt5 or crypt12[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello, and thank you for you patience with me. I am knew to Android, however I have been programming LAMP and Visual Basic and C# for many years.
I am using Android Studio 3.5 and using Kotlin as the language.
I have a very simple question for many of you, however, it is vexing me. I would greatly appreciate your help.
I have created a menu in my android app. The problem I am having is, how do I select a Menu Item and go to a web page?
Here is the code I have.
From MainActivity.kt-----------------------------------------
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_locate -> true
else -> super.onOptionsItemSelected(item)
}
return when (item.itemId) {
R.id.action_scanner -> true
else -> super.onOptionsItemSelected(item)
}
return when (item.itemId) {
R.id.action_qrcodescanner -> true
else -> super.onOptionsItemSelected(item)
}
return when (item.itemId) {
R.id.action_mainsite -> true
else -> super.onOptionsItemSelected(item)
}
------------------------------------------------------------
MenuMain.xml-------------------------------------------------
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.sdf.sdf.MainActivity">
<item
android:id="@+id/action_locate"
android:orderInCategory="100"
android:title="Locate Vehicle"
app:showAsAction="never" />
<item
android:id="@+id/action_scanner"
android:title="BarCode Scanner"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/action_qrcodescanner"
android:icon="@drawable/ic_scanner_black_24dp"
android:orderInCategory="100"
android:title="Q.R. Code Scanner"
app:showAsAction="never" />
<item
android:id="@+id/action_mainsite"
android:icon="@android:drawable/checkbox_on_background"
android:orderInCategory="100"
android:title="TheSite.com"
app:showAsAction="never" />
</menu> ---------------------------------------------
Please tell me if you need any other code.
I just want to know how to make a menu item go to a webpage.
Thank you.
|
|
|
|
|
In response to that menu item, could you do something like:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "https://www.google.com")));
"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, I just wanted my first post here to be one that says Hello. I don't know why they say goodbye, I say Hello.
|
|
|
|
|
Good Beatles reference.
"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 mate, let them saying goodbyes :P
|
|
|
|
|
|
Good Day Everyone
i am doing an app and all is good. My app changes the language based on the device settings as they change. now i hit a wall when i saw dates in Traditional Chinese appeared like this
2019/12/29 下午 09:14:37
obviously when i try to search from the database i get the error that the date is not in the correct format. so since i will do this with different other languages , i want to create some universal or generic way to handle this dates. so i wrote this
public static DateTime Convert_To_System_DateTime(string input)
{
return DateTime.ParseExact(input, "yy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
}
and still i am not getting any joy.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
A date is stored internally as a count, not as a string. It becomes a string after formatting it for a specific culture.
Are you storing your dates as a string, or a DateTime? If it is in XML, try converting everything to the ISO variants.
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.
|
|
|
|
|
What is the content of the input variable?
|
|
|
|
|
Good Day
Since the phone was changed to Chinese Traditional , i had to specify the system date to
var finaldate = input.ToString("yyyy-MM-dd hh:mm:ss tt", CultureInfo.CreateSpecificCulture("en-US"));
and this work for the input "2019/12/29 下午 09:14:3"
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
Vimalsoft(Pty) Ltd wrote: CultureInfo.CreateSpecificCulture("en-US")
Rather than creating a new culture on every call, you could just use CultureInfo.InvariantCulture , which uses US formatting rules for everything.
CultureInfo.InvariantCulture Property (System.Globalization) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
are you storing them as DateTime or as string? it's quite difficult to handle dates stored as string, there are a lot of cases that you have to consider. Either store it as DateTime or as byte and convert bytes to datetime. Never save a Date as a string unless you want only to display that value and not do calculations
|
|
|
|
|
I'm looking for a way to implement a simple list view scrolling in my Firebase app, but I am not getting any way out how to implement this. I have already tried 2-3 tutorials and documentation available on the Internet, but didn't the required result.
In my app I want scrolling like at starting first 10 list items load then each time on scrolling next 10 or 20 items will load until the last item appears at the bottom of the list.
So I tried retrieving first 10 items the following way :
<pre>private void readsposts(){
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
reference.keepSynced(true);
reference.child("Posts")
.limitToLast(10)
.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
postList.clear();
for(DataSnapshot snapshot:dataSnapshot.getChildren()){
Post post = snapshot.getValue(Post.class);
for(String id:followingList){
if(post.getPublisher()!=null && post.getPublisher().equals(id)){
postList.add(post);
}
}
if(post.getPublisher()!=null && post.getPublisher().equals(firebaseUser.getUid())){
postList.add(post);
}
postAdapter.notifyDataSetChanged();
}
mProgressBar.setVisibility(RecyclerView.GONE);
}
@Override public void onCancelled(DatabaseError databaseError) {
mProgressBar.setVisibility(RecyclerView.GONE);
}
});
}
In the above code, as you can see I am generating Log to check if data is fetched from the firebase, but I got no output Android monitor.
I have no idea how can I implement Firebase Scrolling in my Recycler view. I think this is a common problem for those who implement infinite-scroll in recycler view/ list view.
Could you please help me implementing this feature. Thanks.
|
|
|
|
|
I have a good working code for infinite scroll that gets item from online service(parse server) but it is in xamarin, you want me to post it?
|
|
|
|
|
|