Notification Counter - Android Studio Tutorial | Part 1

Notification Counter - Android Studio Tutorial | Part 1

Stevdza-San

4 года назад

27,650 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

chadi sfeir
chadi sfeir - 10.11.2021 16:18

thank you for this tutorial!
i have a question: how to add a badge if the app receives an FCM data type notification? (and the app stat is in the background or killed)

Ответить
Jishnu N Krishnan
Jishnu N Krishnan - 08.02.2021 21:05

Thank You

Ответить
Gibraan Jafar
Gibraan Jafar - 07.01.2021 15:40

The 50dp in app:cardCornerRadius="50dp" is overkill. 9dp will suffice.

Ответить
Thenuja Uthayakumar
Thenuja Uthayakumar - 10.11.2020 02:02

Hy can you help me

Ответить
V Ranjit
V Ranjit - 28.08.2020 10:01

the card to display number is not displaying color

Ответить
Nisith Mondal
Nisith Mondal - 22.08.2020 17:48

great work

Ответить
Jayceed Deyro
Jayceed Deyro - 14.08.2020 20:11

I have a question is there any other way to add notification counter badge in the imageview? or this is the only way?

Ответить
AL G
AL G - 02.08.2020 22:13

Can i ask you two more questions. I had design my application for church liturgy on PlayStore but i don't have any database. I wrote all of them on strings.

1. How can i insert the (liturgy) "words" In to database. ?
2. How to display notifications when there is a new the liturgy or information for user.

Where should i start. Please kindly give you're link or tutorial video related to my questions.

Ответить
Rohit Pachisia
Rohit Pachisia - 24.07.2020 23:47

Plz.. make a video on add to cart

Ответить
adfinem.rising
adfinem.rising - 04.06.2020 08:37

hahaha you forced me to change my linear layout to constraint layout. i learned quite a bit :)

Ответить
S J
S J - 01.05.2020 13:57

I want to place button in one activity and notification counter toolbar in another activity.but when button click counter not incrementing

Ответить
Muhammad Tio Laksono
Muhammad Tio Laksono - 17.04.2020 04:43

please share this code please ..

Ответить
S J
S J - 16.04.2020 09:46

thanks for the video

Ответить
durra hassan
durra hassan - 14.04.2020 18:27

really i love you sir

Ответить
Atakan Yildirim
Atakan Yildirim - 05.01.2020 20:57

Thanks

Ответить
Mohamed Ibrahim
Mohamed Ibrahim - 21.11.2019 13:17

package com.example.page1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
private Button button;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

button =(Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

openpage2();


}
});


}
public void openpage2()
{
Intent intent = new Intent(this, page2.class);
startActivity(intent);
}
}

Ответить
Mohamed Ibrahim
Mohamed Ibrahim - 21.11.2019 12:23

2
--
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);



Button dispyBtn = findViewById(R.id.displyBtn);
Bundle b1 = getIntent().getExtras();
String s =b1.getString("name");
dispyBtn.setText(s);

implicit email
public class MainActivity extends AppCompatActivity {
private EditText mEditTextTo;
private EditText mEditTextSubject;
private EditText mEditTextMessage;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mEditTextTo = findViewById(R.id.edit_text_to);
mEditTextSubject = findViewById(R.id.edit_text_subject);
mEditTextMessage = findViewById(R.id.edit_text_message);

Button buttonSend = findViewById(R.id.button_send);
buttonSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMail();
}
});
}

private void sendMail() {
String recipientList = mEditTextTo.getText().toString();
String[] recipients = recipientList.split(",");

String subject = mEditTextSubject.getText().toString();
String message = mEditTextMessage.getText().toString();

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, recipients);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_TEXT, message);

intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Choose an email client"));
}
}
----------------------------------------------------------------------------

Ответить
Mohamed Ibrahim
Mohamed Ibrahim - 21.11.2019 12:21

shared prafrance
================
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;

import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private int mcount = 0;
private TextView countntertextview;
private SharedPreferences preferences;
private String prefile = "com.example.myapplication";
private int mcolor;
private String counter_key = "counter";
private String color_key = "color";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
countntertextview = findViewById(R.id.count_textview);
preferences = getSharedPreferences(prefile,MODE_PRIVATE);
mcount = preferences.getInt(counter_key, 0);
mcolor = preferences.getInt(color_key, R.color.default_background);

countntertextview.setText(String.valueOf(mcount));
countntertextview.setBackgroundColor(mcolor);
}
@Override
protected void onPause() {
super.onPause();
SharedPreferences.Editor editor = preferences.edit();
editor.putInt(counter_key,mcount);
editor.putInt(color_key,mcolor);
editor.apply();
}
public void changeBackground(View view) {
int color = ((ColorDrawable)view.getBackground()).getColor();
countntertextview.setBackgroundColor(color);
mcolor = color;
}

public void countUp(View view) {
mcount ++;
countntertextview.setText(String.valueOf(mcount));
}

public void reset(View view) {
mcount = 0;
mcolor =R.color.default_background;
countntertextview.setText(String.valueOf(mcount));
countntertextview.setBackgroundColor(mcolor); }
}

Ответить
Mohamed Ibrahim
Mohamed Ibrahim - 21.11.2019 12:20

intent
------
package com.example.section4v1;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import org.w3c.dom.Text;

public class MainActivity extends AppCompatActivity {
//reference
int q = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);



Button dispyBtn = findViewById(R.id.displyBtn);
Button plusBtn = findViewById(R.id.incrementBtn);
Button minusBtn = findViewById(R.id.decBtn);
Button sendBtn = findViewById(R.id.sndBtn);


sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotToSecondActivty();
}
});

//listnere
dispyBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
displyName();
displyLoc();

}
});


plusBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
increment();
displayQ();
}
});

minusBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
decrement ();
displayQ();
}
});

}



//
private void increment () {
q++;
}

private void decrement () {
q--;
}




// disply

private void displayQ () {
TextView qTxtview = findViewById(R.id.qunityTxtview);
qTxtview.setText(String.valueOf(q));
}
private void displyName () {

TextView nameDislyTtview = findViewById(R.id.displyNameTxtview);
EditText nameEdiTxt = findViewById(R.id.nameEditText);
String name = nameEdiTxt.getText().toString();
nameDislyTtview.setText(name);

}

private void displyLoc () {
String loc = " ";
RadioButton caiorRadioBtn = findViewById(R.id.cairoRadioBtn);
RadioButton alexRadioBtn = findViewById(R.id.alexRadioBtn);
TextView locDoisplyTextView = findViewById(R.id.displyLocationTxtview);
if (caiorRadioBtn.isChecked()) {
loc = "Caior";
}else if (alexRadioBtn.isChecked()){
loc = "alex";
}else {
loc = "you naeed to selcte one";
}


locDoisplyTextView.setText(loc.toString());


}


public void gotToSecondActivty () {
Intent gotTonextActivty = new Intent(this , SecondActivity.class);
startActivity(gotTonextActivty);


}


}

Ответить
Fun Zone
Fun Zone - 03.11.2019 18:12

Very nice . New subscriber 👌
Please upload videos regular

Ответить
Pankaj Wandre
Pankaj Wandre - 03.11.2019 17:01

👍👍👍👍👍👍
Finally i got video on notifications....
But still waiting for videos on database..

Ответить
rajesh sanga
rajesh sanga - 03.11.2019 12:29

I want video tutorial of payment system in app

Ответить