learn java coding for android

Rishikesh in Uttarakhand

Set color frome Resourse on Activity in android

getResources().getColor(R.color.colorPrimary) ;

Send data one activity to another Activity by using Intent

Intent intent=new Intent(currentActivity Name,TargateActivityName.class);
acTextIntent.putExtra("PrType",btnName);
startActivity(intent);

Receive data one activity to another Activity by using Intent

String PrName = getIntent().getStringExtra("PrType");

Set received data on views

title.setText(PrName);

Remove any kind of white space ,alphabet letter,extra sign in string by using this code

String ch = "-";
String replceWith = replceWith.replace(" ",ch);

Send And Receive Multiple Data Using Intent;

Intent myIntent = new Intent(mycurentActivity.this, secondActivity.class);
myIntent.putExtra("key", myEditText1.Text.toString());
myIntent.putExtra("key1", myEditText2.Text.toString());
myIntent.putExtra("key2", myEditText3.Text.toString());
startActivity(myIntent);
String text = myIntent.getStringExtra("key1");
String text1 = myIntent.getStringExtra("key2");
String text3 = myIntent.getStringExtra("key");

Set Image using glide library

Glide.with(context) .load("Pass Url Here "+item.getBrImage())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.placeholder)
.error(R.drawable.imagenotfound)
.into(brImage);;

Rajeshbhatt12

My name is Rajesh Bhatt. I am working as a senior android developer . I have created this blog for kotlin ,java and Android Development interview questions etc..

Previous Post Next Post