Tumgik
#shipon sarker
shipon2004 · 2 months
Text
Me Leaning pymeant number API
 "bkash":" বিকাশে/নগদ/রকেট  একাউন্টে <b>সেন্ডমানি</b> করতে নিচের নাম্বারে পাঠিয়ে দিন<br><br> 01850140801",
        "ngod":"বিকাশ মার্চেন্ট একাউন্টে পেমেন্ট করতে  নিচের নাম্বারে পাঠিয়ে দিন  <br><br> 01863464968",
        "roket":"VISA Card এ পেমেন্ট করতে  নিচের একাউন্ট নাম্বারে পাঠিয়ে দিন <br><br> 4628 7020 1331 7305",
0 notes
shipon2004 · 2 months
Text
Delete item
<?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout 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" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".FreeBankActivity" >
<com.google.android.material.appbar.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_free_bank" />
<com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_marginEnd="@dimen/fab_margin" android:layout_marginBottom="16dp" app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
0 notes
shipon2004 · 2 months
Text
ProgressBar
<ProgressBar
android:layout_width="match_parent" android:layout_height="wrap_content" style="@style/Widget.AppCompat.ProgressBar.Horizontal" android:id="@+id/progressBsr" android:indeterminate="true"
/>
0 notes
shipon2004 · 2 months
Text
Custom Switch in android java
Tumblr media
0 notes
shipon2004 · 2 months
Text
0 notes
shipon2004 · 2 months
Text
PDF Downlod and Ofline view
dependencies {
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1' implementation 'com.airbnb.android:lottie:6.3.0' implementation 'com.mindorks.android:prdownloader:0.6.0' } //-------
MainActivity -----------------
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:background="@color/white" android:gravity="center" android:orientation="vertical" tools:context=".MainActivity" >
<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundTint="#BCCC25" android:padding="10sp" android:text="PDF One View" android:textColor="#60BF46" android:textSize="30dp" />
<Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:backgroundTint="#395393" android:padding="10sp" android:text="PDF One View" android:textColor="#33BAB6" android:textSize="30dp" />
</LinearLayout>
Tumblr media
Main Activity.java class
package com.shipon.pdflodanddownlod;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.webkit.URLUtil; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Toast;
import com.downloader.Error; import com.downloader.OnCancelListener; import com.downloader.OnDownloadListener; import com.downloader.OnPauseListener; import com.downloader.OnProgressListener; import com.downloader.OnStartOrResumeListener; import com.downloader.PRDownloader; import com.downloader.Progress;
import java.io.File;
public class MainActivity extends AppCompatActivity {
Button button1, button2; int downloadId;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PRDownloader.initialize(getApplicationContext());
button1 = findViewById(R.id.button1); button2 = findViewById(R.id.button2);
button1.setOnClickListener(v -> {
String pdfurl = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf";
File fil = new File(getCacheDir(), URLUtil.guessFileName(pdfurl, null, null));
if (fil.exists()){
Intent intent = new Intent(MainActivity.this, MainActivity2.class); intent.putExtra("isOnline", false); intent.putExtra("pdfurl", pdfurl); startActivity(intent);
}else { showDialog(pdfurl); }
});
button2.setOnClickListener(v -> {
String pdfurl = "https://www.clickdimensions.com/links/TestPDFfile.pdf"; File fil = new File(getCacheDir(), URLUtil.guessFileName(pdfurl, null, null));
if (fil.exists()){
Intent intent = new Intent(MainActivity.this, MainActivity2.class); intent.putExtra("isOnline", false); intent.putExtra("pdfurl", pdfurl); startActivity(intent);
}else { showDialog(pdfurl); }
});
}//============== onCreate end method ================= public void showDialog(String pdfUrl) {
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this); LayoutInflater inflater = getLayoutInflater();
View myView = inflater.inflate(R.layout.choose_item, null); Button btOnline = myView.findViewById(R.id.btOnline); Button btDownlod = myView.findViewById(R.id.btDownlod); Button btCancel = myView.findViewById(R.id.btCancel); alert.setView(myView);
AlertDialog alertDialog = alert.create();
alertDialog.setCancelable(false);
btOnline.setOnClickListener(v -> {
Intent intent = new Intent(MainActivity.this, MainActivity2.class); intent.putExtra("isOnline", true); intent.putExtra("pdfurl", pdfUrl); startActivity(intent);
alertDialog.dismiss();
});
btDownlod.setOnClickListener(v -> {
downlodPDF(pdfUrl); alertDialog.dismiss(); });
btCancel.setOnClickListener(v -> {
alertDialog.dismiss();
});
alertDialog.show(); }// how Dialog end method -------- private void downlodPDF(String pdfurl) {
ProgressDialog progressDialog=new ProgressDialog(MainActivity.this); progressDialog.setIcon(R.drawable.down_24); progressDialog.setMessage("Downloading PDF File, Please Wait a moment..."); progressDialog.setCancelable(false); progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getApplicationContext(), "Downlod Start", Toast.LENGTH_SHORT).show(); PRDownloader.cancel(downloadId); progressDialog.dismiss(); } });
progressDialog.show(); downloadId = PRDownloader.download(pdfurl, String.valueOf(getCacheDir()), URLUtil.guessFileName(pdfurl, null, null)) .build() .setOnStartOrResumeListener(new OnStartOrResumeListener() { @Override public void onStartOrResume() {
} }) .setOnPauseListener(new OnPauseListener() { @Override public void onPause() {
} }) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel() {
} }) .setOnProgressListener(new OnProgressListener() { @Override public void onProgress(Progress progress) { int progressPercentage = (int) (progress.currentBytes*100/progress.totalBytes); progressDialog.setMessage("Downlod : "+progressPercentage+" %");
} }) .start(new OnDownloadListener() { @Override public void onDownloadComplete() {
Toast.makeText(getApplicationContext(), "Downlod Completed", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(MainActivity.this, MainActivity2.class); intent.putExtra("isOnline", false); intent.putExtra("pdfurl", pdfurl); startActivity(intent);
progressDialog.dismiss(); }
@Override public void onError(Error error) {
Toast.makeText(getApplicationContext(), "Downlod Failed", Toast.LENGTH_SHORT).show(); progressDialog.dismiss(); } });
}
}//============== public class ==========================
Tumblr media
MainActivity 2 xmal class start
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" tools:context=".MainActivity2">
<com.airbnb.lottie.LottieAnimationView android:id="@+id/lotti" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="invisible" app:lottie_autoPlay="true" app:lottie_loop="true" app:lottie_rawRes="@raw/pdf" />
<com.github.barteksc.pdfviewer.PDFView android:id="@+id/pdfView" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="invisible" />
</RelativeLayout>
MainActivity2.java class start
package com.shipon.pdflodanddownlod;
import androidx.appcompat.app.AppCompatActivity;
import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.webkit.URLUtil; import android.widget.Toast;
import com.airbnb.lottie.LottieAnimationView; import com.github.barteksc.pdfviewer.PDFView; import com.github.barteksc.pdfviewer.util.FitPolicy;
import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL;
public class MainActivity2 extends AppCompatActivity {
// public static String AssateName=""; LottieAnimationView lotti; PDFView pdfView;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2);
pdfView = findViewById(R.id.pdfView); lotti = findViewById(R.id.lotti); lotti.setVisibility(View.VISIBLE);
boolean isOnline = getIntent().getBooleanExtra("isOnline", true); String pdfurl = getIntent().getStringExtra("pdfurl"); if (isOnline == true) { new RetrivePDFfromUrl().execute(pdfurl);
} else {
File fil = new File(getCacheDir(), URLUtil.guessFileName(pdfurl, null, null));
lodPDFOffline(fil);
}
}//============= onCreate ned method =================== private class RetrivePDFfromUrl extends AsyncTask<String, Void, InputStream> { @Override protected InputStream doInBackground(String... strings) {
try { URL url = new URL(strings[0]); HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
if (httpURLConnection.getResponseCode() == HttpURLConnection.HTTP_OK) { return new BufferedInputStream(httpURLConnection.getInputStream()); }
} catch (MalformedURLException e) { throw new RuntimeException(e);
} catch (IOException e) { throw new RuntimeException(e); }
return null; }
@Override protected void onPostExecute(InputStream inputStream) { super.onPostExecute(inputStream);
if (inputStream != null) { lodPDFOnline(inputStream);
} else { Toast.makeText(MainActivity2.this, "PDF lod failed", Toast.LENGTH_SHORT).show(); }
} }
private void lodPDFOnline(InputStream inputStream) {
pdfView.fromStream(inputStream) .enableSwipe(true) .swipeHorizontal(true) .enableDoubletap(true) .defaultPage(0) .enableAnnotationRendering(false) .password(null) .scrollHandle(null) .enableAntialiasing(true) .spacing(0) .pageFitPolicy(FitPolicy.WIDTH) .pageSnap(true) // snap pages to screen boundaries .pageFling(true) // make a fling change only a single page like ViewPager .onLoad(nbPages -> { lotti.setVisibility(View.GONE); pdfView.setVisibility(View.VISIBLE);
}) .load();
}
private void lodPDFOffline(File file) {
pdfView.fromFile(file) .enableSwipe(true) .swipeHorizontal(true) .enableDoubletap(true) .defaultPage(0) .enableAnnotationRendering(false) .password(null) .scrollHandle(null) .enableAntialiasing(true) .spacing(0) .pageFitPolicy(FitPolicy.WIDTH) .pageSnap(true) // snap pages to screen boundaries .pageFling(true) // make a fling change only a single page like ViewPager .onLoad(nbPages -> { lotti.setVisibility(View.GONE); pdfView.setVisibility(View.VISIBLE);
}) .load();
}
}//= ==================== public calss end method =======================
Tumblr media
0 notes
shipon2004 · 2 months
Text
Java তে setContentView এর উপরে আমার দেওয়া কোড তা লিখে দিন । কোডঃ getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
Tumblr media
0 notes
shipon2004 · 3 months
Text
Tutorial 41 : INNER JOIN in SQL
Tumblr media
coding=----
SELECT std.Roll, exam.Reg_number, std.Name,std.Gender,exam.Group_name,exam.GPA
FROM student_details AS std INNER JOIN exam_result AS exam ON std.Roll = exam.Roll;
0 notes
shipon2004 · 3 months
Text
Tutorial 40 : JOIN Clause in SQL
Tumblr media
coding --
SELECT std.Roll, exam.Reg_number,std.Name, std.Gender,exam.Group_name,exam.GPA
FROM student_details AS std ,exam_result AS exam WHERE std.Roll =exam.Roll;
SELECT std.Roll, exam.Reg_number, std.Name,std.Gender,exam.Group_name,exam.GPA
FROM student_details AS std JOIN exam_result AS exam ON std.Roll = exam.Roll;
0 notes
shipon2004 · 3 months
Text
Tutorial 39 : Joining Tables
Tumblr media
SELECT student_details.Roll, Reg_number,Name,Gender,Group_name,GPA FROM student_details,exam_result WHERE student_details.Roll =exam_result.Roll;
out put
Tumblr media
0 notes
shipon2004 · 3 months
Text
Class 32
Coding --------------------
Tumblr media
SELECT CONCAT (Name ,' is ', Age , 'year old') FROM student_details;
output ---------------------
Tumblr media
coding ---
SELECT CONCAT (Name ,' is ', Age , 'year old')AS student FROM student_details;
output
Tumblr media
##new coding
SELECT GREATEST(10,20,502,-5,18);
Tumblr media
out put
Tumblr media
#new coding
SELECT LEAST(10,-3,5,8);
output
Tumblr media
0 notes
shipon2004 · 3 months
Text
Class 26. LIKE logical operator
Tumblr media
Code=
SELECT * FROM student_details WHERE Name LIKE '%S%';
out put-----
Tumblr media
new codi
SELECT * FROM student_details WHERE Name LIKE '%A';
Tumblr media
out put ---
Tumblr media
যদি একটি লাইন গেপ দিয়ে বর্ণ খুজি তাহলে নিচের কোড গুলা কাজে লাগবে
SELECT * FROM student_details WHERE Name LIKE '_u%';
Tumblr media
out put
Tumblr media
0 notes
shipon2004 · 3 months
Text
in , not, in class 25
Tumblr media
Bangla Database Tutorial 25 : IN, NOT IN | Logical Operator
test 1 --- coding
SELECT * FROM student_details WHERE City='Sylhet' OR City='Dhaka' OR City='Barishal';
out put
Tumblr media
new codine . how to use in
SELECT * FROM student_details WHERE City IN ('sylhet','Dhaka', 'Barisal');
pic
Tumblr media
how use php Not in
SELECT * FROM student_details WHERE City NOT IN ('sylhet','Dhaka', 'Barisal');
out put--- pic
Tumblr media
0 notes
shipon2004 · 3 months
Text
SharedPreference to pic save
Tumblr media
Button picImage,btnsaveImage; ImageView imageView,saveView; SharedPreferences preferences; SharedPreferences.Editor editor;
///-- oncreate start method ----
btnsaveImage=findViewById(R.id.btnsaveImage); saveView=findViewById(R.id.saveView);
preferences=getSharedPreferences("mypic", Context.MODE_PRIVATE); editor=preferences.edit();
String incodingSaveImage=preferences.getString("image",""); byte[] decodeString =Base64.decode(incodingSaveImage,Base64.DEFAULT); Bitmap decodeBitmap= BitmapFactory.decodeByteArray(decodeString,0,decodeString.length);
if (decodeBitmap!= null){ saveView.setImageBitmap(decodeBitmap); } btnsaveImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bitmap bitmap=((BitmapDrawable) imageView.getDrawable()).getBitmap(); ByteArrayOutputStream outputStream=new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG,100,outputStream); byte[] bytesArray= outputStream.toByteArray(); String incolodedImag= Base64.encodeToString(bytesArray,Base64.DEFAULT); editor.putString("image",incolodedImag); editor.apply(); Toast.makeText(getApplicationContext(),"Image is save",Toast.LENGTH_LONG).show(); } });
0 notes
shipon2004 · 3 months
Text
ShoAllData java .class
public class ShoAllData extends AppCompatActivity {
ListView listView; TextView tvTitle; DataBaseHelper dbhelper;
ArrayList<HashMap<String,String>> arrayList; HashMap<String,String> hashMap;
public static boolean Expence=true;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sho_all_data); listView=findViewById(R.id.listView); tvTitle=findViewById(R.id.tvtitles); dbhelper=new DataBaseHelper(this);
if (Expence==true)tvTitle.setText(" total expense Data"); else tvTitle.setText(" total Income Data");
lodData();
}//----------------------------------- public void lodData(){ Cursor cursor=null;
if (Expence==true){ cursor=dbhelper.getAllExpense(); }else { cursor=dbhelper.getAllIncom(); }
if (cursor!=null && cursor.getCount()>0){
arrayList=new ArrayList<>();
while (cursor.moveToNext()){ int id=cursor.getInt(0); double amount=cursor.getDouble(1); String reason=cursor.getString(2); double time=cursor.getDouble(3); hashMap=new HashMap<>(); hashMap.put("id",""+id); hashMap.put("amount",""+amount); hashMap.put("reason",""+reason); hashMap.put("time",""+time); arrayList.add(hashMap);
} listView.setAdapter(new Myadepter());
}else { tvTitle.append("\n No Data found");
}
}
public class Myadepter extends BaseAdapter{
@Override public int getCount() { return arrayList.size(); }
@Override public Object getItem(int position) { return null; }
@Override public long getItemId(int position) { return 0; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater=getLayoutInflater(); View myView = inflater.inflate(R.layout.item,parent,false);
TextView tvreason=myView.findViewById(R.id.tvreason); TextView tvExpenses=myView.findViewById(R.id.tvExpenses); TextView delete=myView.findViewById(R.id.delete); ImageView item_image=myView.findViewById(R.id.item_image);
if (Expence==true){ item_image.setImageResource(R.drawable.expense); }else { item_image.setImageResource(R.drawable.income); tvExpenses.setTextColor(Color.parseColor("#009688")); }
hashMap=arrayList.get(position); String id=hashMap.get("id"); String amount=hashMap.get("amount"); String reason=hashMap.get("reason");
tvreason.setText(reason); tvExpenses.setText(amount);
delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {
if (Expence==true){
dbhelper.deleteExpense(id);
}else {
dbhelper.deleteIncome(id); } lodData();
} });
return myView; } }//-----------------------------------
0 notes
shipon2004 · 3 months
Text
DataBaseHelper class . java---------------
Tumblr media
public class DataBaseHelper extends SQLiteOpenHelper {
public DataBaseHelper(Context context) { // টেবিল এর নাম digital_moneybag super(context, "digital_moneybag", null, 1); }
@Override public void onCreate(SQLiteDatabase db) { // এখানে দুইটি টিবিল তৈরি করা হইছে । একটি নাম: expense ও আরেক টির নাম income । চারটি কলাম নেয়া হইছে id,amount,reason, time; db.execSQL("Create table expense (id INTEGER primary key autoincrement, amount DOUBLE, reason TEXT,time DOUBLE )"); db.execSQL("Create table income (id INTEGER primary key autoincrement, amount DOUBLE, reason TEXT,time DOUBLE )");
}
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // ইরর বা কোনো সমস্যর জন্য এটি ডিলিট করে দেয় db.execSQL("drop table if exists expense"); db.execSQL("drop table if exists income");
}
// ----------------------- --------------------------- public void addExpense(double amount,String reason){
// টেবিল এর মধ্যে ডাটা ইন্সাট করানে হলো SQLiteDatabase db=this.getWritableDatabase();
ContentValues values=new ContentValues(); // ContentValues এটি hasmap এর কাজ করে values.put("amount",amount); values.put("reason", reason); values.put("time",System.currentTimeMillis()); db.insert("expense",null,values);
// db.insert এরে লিষ্ট এর মতো কাজ করে ------------ } //- ----------------------------------------------------------- // ----------------------- --------------------------- public void addIncome(double amount,String reason){
// this.getWritableDatabase(); এটার মানে হলো ডাটাবেজ এর মধ্যে ডাটা ডোকানো / ডাটা লিখা -- SQLiteDatabase db=this.getWritableDatabase(); ContentValues values=new ContentValues(); values.put("amount",amount); values.put("reason", reason); values.put("time",System.currentTimeMillis()); db.insert("income",null,values);
} //- ----------------------------------------------------------- //=================================================================== public double calcularTotalExpense(){
double totalExpense=0;
// this.getReadableDatabase(); এটার মানে হলো ডাটাবেজ এর মধ্যে ডাটা খুজে বাহির করা / পড়া SQLiteDatabase db=this.getReadableDatabase(); Cursor cursor=db.rawQuery("select * from expense",null);
if (cursor!=null && cursor.getCount()>0){ while (cursor.moveToNext()){// while এর মানে হলো যত খন পর্যন্ত কলাম শেষ না হবে ততখন পর্যন্ত কন্ডিশন চালো রাখা double amount=cursor.getDouble(1); totalExpense=totalExpense +amount; }
} return totalExpense;
} // ---------------------------------- //=================================================================== public double calcularTotalIncome(){
double totalIncome=0;
SQLiteDatabase db=this.getReadableDatabase(); Cursor cursor=db.rawQuery("select * from income",null);
if (cursor!=null && cursor.getCount()>0){ while (cursor.moveToNext()){ double amount=cursor.getDouble(1); totalIncome=totalIncome +amount; }
} return totalIncome;
} // ---------------------------------- public Cursor getAllExpense(){
SQLiteDatabase db=this.getReadableDatabase(); Cursor cursor=db.rawQuery("select * from expense",null);
return cursor; }
public Cursor getAllIncom(){ SQLiteDatabase db=this.getReadableDatabase(); Cursor cursor=db.rawQuery("select * from income",null); return cursor; }
public void deleteExpense(String id){
SQLiteDatabase db=this.getReadableDatabase(); db.execSQL("DELETE from expense where id like "+id);// এই লাইনটার মানে হলো ডাটা বেজ থেকে ডাটা ডিলিট করা -- } public void deleteIncome(String id){
SQLiteDatabase db=this.getReadableDatabase(); db.execSQL("DELETE from income where id like "+id);
}
0 notes