switching activities using spinner - java

i have the below code and i need to fill in the if(pos == 1){??????????} so that i can switch activities when the first position in my spinner is selected. The name of my new acitivity is Route1.java.
How would i write the code to switch to Route1.java when position 1 is selected in my spinner.
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Toast;
import android.Manifest.permission;
public class MyOnItemSelectedListener extends Activity
implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
if (pos == 1) {
} else {
Toast.makeText(parent.getContext(),
"Your route is "
+ parent.getItemAtPosition(pos).toString(),
Toast.LENGTH_LONG).show();
}
}
public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
}
the above class is used in this class
import java.lang.reflect.Array;
import android.R.array;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.AbsSpinner;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Toast;
public class cnycentro extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cnycentro);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.routes, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
}
}

MyOnItemSelectedListener() doesn't need to be a separate class, and it definitely shouldn't inherit from Activity.
Change your code to something like this:
OnItemSelectedListener listener = new OnItemSelectedListener(){
#Override
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
//do you really want 1 here or 0?
if (position == 1) {
view.getContext().startActivity(new Intent(view.getContext().getApplicationContext(),Route1.class));
}else{
Toast.makeText(parent.getContext(), "Your route is " +
parent.getItemAtPosition(position).toString(), Toast.LENGTH_LONG).show();
}
}
#Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
};
spinner.setOnItemSelectedListener(listener);

You should read up on intents and more specifically explicit intents.
In order to launch explicitly a new activity (like one you created) the syntax is:
Intent newActivity = new Intent(this, Route1.class);
startActivity(newActivity);
Also be sure to add the new activity to the android manifest:
<activity android:name=".Route1"></activity>
Edit:
+1 for not extending Activity in your listener, instead simply write
public class MyOnItemSelectedListener implements OnItemSelectedListener {
....
}
You can write it this way if your Activity or Listener is too large and it would reduce readability to write it inline.

Related

Android won't open new activity from listview

The app stops working when clicking on the first item on the list! I tried writing the code in a couple of different ways but it still won't work! What am I doing wrong??
package com.vogella.android.filmapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String [] filmArray = {"Harry Potter", "No time to die", "Finding Dory", "Spider-Man",
"The Avengers", "Little Women", "Dune"};
ListAdapter theAdapter = new MyAdapter(this,filmArray);
ListView film_list_view= findViewById(R.id.film_list_view);
film_list_view.setAdapter(theAdapter);
film_list_view.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position==0){
Intent intent = new Intent(view.getContext(), HarryPotter.class);
startActivity(intent);
}
}
});
}
}
Help?

RecyclerView don't show items even if I call notifyDataSetChanged()

I'm using a RecyclerView to show datas but even if I call notifyDataSetChanged() after I got the list from Room db I can't see the items on the first creation of the fragment, but only on second one.
MainActivity.class
package it.bastoner.taboom;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.room.Room;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationBarView;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import it.bastoner.taboom.database.CardDAO;
import it.bastoner.taboom.database.CardEntity;
import it.bastoner.taboom.database.DatabaseTaboom;
import it.bastoner.taboom.fragments.AddFragment;
import it.bastoner.taboom.fragments.BaseCardFragment;
import it.bastoner.taboom.fragments.PlayFragment;
import it.bastoner.taboom.fragments.UpdateFragment;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private List<CardEntity> cardList;
private boolean cardListIsUpdated;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d(TAG, ">>MainActivity created");
cardList = new ArrayList<CardEntity>();
// Setting bottomNavigation
BottomNavigationView bottomNav = findViewById(R.id.bottom_nav);
bottomNav.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
//TODO ANIMATION
#Override
public boolean onNavigationItemSelected(#NonNull MenuItem item) {
// By using switch we can easily get the selected fragment by using there id.
Fragment selectedFragment = null;
switch (item.getItemId()) {
case R.id.add_nav:
selectedFragment = new AddFragment(cardList);
break;
case R.id.play_nav:
selectedFragment = new PlayFragment(cardList);
break;
case R.id.update_nav:
selectedFragment = new UpdateFragment(cardList);
break;
}
// It will help to replace the
// one fragment to other.
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, selectedFragment)
.commit();
return true;
}
});
// As soon as the application opens the play fragment should be shown to the user
bottomNav.setSelectedItemId(R.id.play_nav);
loadCardList();
}
private void loadCardList() {
CardDAO cardDAO = DatabaseTaboom.getDatabase(getApplicationContext()).cardDao();
// Setting cardsList
ExecutorService executor = Executors.newSingleThreadExecutor();
Runnable runnable = new Runnable() {
#Override
public void run() {
cardList = cardDAO.getAll();
Log.d(TAG, ">>Cardlist: " + cardList);
BaseCardFragment actualFragment = (BaseCardFragment) getSelectedFragment();
if (actualFragment != null)
actualFragment.updateUI();
else
Log.d(TAG, ">>Null fragment");
}
};
executor.execute(runnable);
}
private Fragment getSelectedFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
List<Fragment> fragmentList = fragmentManager.getFragments();
for (Fragment f: fragmentList) {
if (f != null && f.isVisible())
return f;
}
return null;
}
}
PlayFragment.class
package it.bastoner.taboom.fragments;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.media.MediaPlayer;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SnapHelper;
import android.os.CountDownTimer;
import android.text.InputFilter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import java.util.Locale;
import it.bastoner.taboom.R;
import it.bastoner.taboom.adapter.RecyclerViewAdapter;
import it.bastoner.taboom.database.CardEntity;
import it.bastoner.taboom.filters.MinMaxFilter;
import it.bastoner.taboom.listeners.MyDialogListener;
public class PlayFragment extends BaseCardFragment implements MyDialogListener {
private static final String TAG = "PlayFragment";
private RecyclerView recyclerView;
private TextView timerTextView;
private Button playPauseButton;
private Button resetButton;
private CountDownTimer countDownTimer;
private long startTimeInMillis;
private boolean timerIsRunning;
private long timeLeftInMillis = startTimeInMillis;
private MediaPlayer endTimerSound;
public PlayFragment(List<CardEntity> cardList) {
super(cardList);
//Log.d(TAG, "PlayFragment created");
}
#Override
public void updateUI() {
recyclerView.getAdapter().notifyDataSetChanged();
Log.d(TAG, ">>Update, number of items: " + recyclerView.getAdapter().getItemCount());
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(TAG, ">>OnCreateView");
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_play, container, false);
}
#Override
public void onViewCreated(#NonNull View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Log.d(TAG, ">>OnViewCreated");
setRecyclerView();
setTimerSound();
setTimer();
setDialogModifyTimer();
updateUI();
}
// other methods...
}
As you can see in the console the cardList has received elements before the call of UpdateUI() but in update the first time is called no elements are seen. Can you help me? I don't understand why, thank you.
I think you need to set the Data in the RecyclerAdapter. Then call it inside your fragment with a ViewModel. I'm using Kotlin sorry.
This works only if u are using RoomDB with viewModel and repositories
In your RecyclerAdapter, you first need to set an empty list
private var timerList = emptyList<EntityClassName>()
// Now use a method to set the Data
fun setData(timer : List<EntityClassName>){
this.timerList = timer
notifyDataSetChanged()
}
Then you call this on your Fragment inside OnViewCreated.
sharedViewModel.readAllData.observe(viewLifecycleOwner,Observer {
data -> myAdapter.setData(data)})

using bitmap with custom spinner

I used this tutorial to make a custom spinner but now I'm having a java.lang.OutOfMemoryError: Failed to allocate a 95976012 byte allocation with 16777120 free bytes and 31MB until OOMerror. I am aware that I should use bitmaps I just don't know how to include the bitmapFactory in my CustomAdapter. I have already compressed my images to sizes less than 16kb and put them in the mipmap folder because they are icons. I have also already tried
<application
android:largeHeap="true"
</application>
Here's my code :
MainActivity.java
package com.kathure.flags;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;
import static android.R.attr.id;
import static android.graphics.BitmapFactory.*;
import static java.security.AccessController.getContext;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
String[] countryNames= {
"Kenya" , "Malawi", "Nigeria", "Rwanda", "Tanzania", "Uganda"
};
int [] flags = {
R.mipmap.kenyamin,R.mipmap.malawimin, R.mipmap.nigeriamin, R.mipmap.rwandamin, R.mipmap.tanzaniamin, R.mipmap.ugandamin
};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//Getting the instance of Spinner and applying OnItemSelectedListener on it
Spinner spin = (Spinner) findViewById(R.id.simpleSpinner);
spin.setOnItemSelectedListener(this);
CustomAdapter customAdapter=new CustomAdapter(getApplicationContext(),flags,countryNames);
spin.setAdapter(customAdapter);
}
#Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
Toast.makeText(getApplicationContext(), countryNames[i], Toast.LENGTH_LONG).show();
}
#Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
CustomAdapter.java
package com.kathure.flags;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by kathure on 28/09/16.
*/
public class CustomAdapter extends BaseAdapter {
Context context;
int flags[];
String[] countryNames;
LayoutInflater inflter;
public CustomAdapter(Context applicationContext, int[] flags, String[] countryNames) {
this.context = applicationContext;
this.flags = flags;
this.countryNames = countryNames;
inflter = (LayoutInflater.from(applicationContext));
}
#Override
public int getCount() {
return flags.length;
}
#Override
public Object getItem(int i) {
return null;
}
#Override
public long getItemId(int i) {
return 0;
}
#Override
public View getView(int i, View view, ViewGroup viewGroup) {
view = inflter.inflate(R.layout.custom_spinner_items, null);
ImageView icon = (ImageView) view.findViewById(R.id.imageView);
TextView names = (TextView) view.findViewById(R.id.textView);
icon.setImageResource(flags[i]);
names.setText(countryNames[i]);
return view;
}
}

store multiple views in recylerview using sharedpreferences on runtime

Hi am using a "Add" button in ActionBar of my app on clicking it a ListView gets open and the user can tap on any list item to add that item to the RecyclerView which is the parent activity(MainActivity holding the Recyclerview) but on exiting the app the last added item stays on MainActivity's view. I guess SharedPreferences' Editor is getting overwritten everytime. Can you please help in providing some snippet as i can't call editor.put() method multiple times as the click happens on listView. My RecyclerView contains an image and a text.
Here is my MainActivity's Code
package com.example.mohitmehndiratta.customlistadap;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Icon;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import static android.support.v7.widget.LinearLayoutManager.*;
public class MainActivity extends AppCompatActivity {
public static ArrayList<DataSet> alist;
int i;
RecyclerView rv;
static RecycledAdap adap;
static String args;
static int rid;
static SharedPreferences sharedPreferences;
public static void addnow(String arg)
{
args=arg;
rid=R.drawable.i;
alist.add(new DataSet(args,rid));
adap.notifyDataSetChanged();
SharedPreferences.Editor editor=sharedPreferences.edit();
editor.putInt("Iconid",rid);
editor.putString("AppName",args);
editor.apply();
if (sharedPreferences!=null)
{
int x=sharedPreferences.getInt("Iconid",rid);
String y=sharedPreferences.getString("AppName",args);
addnow(y);
}
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater=getMenuInflater();
inflater.inflate(R.menu.new_menu,menu);
return super.onCreateOptionsMenu(menu);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId()==R.id.addbtn)
{
Intent intent=new Intent(this,AppList.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sharedPreferences = getSharedPreferences("MyPrefs",getApplicationContext().MODE_PRIVATE);
rv=(RecyclerView)findViewById(R.id.rv);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
rv.setLayoutManager(mLayoutManager);
rv.setItemAnimator(new DefaultItemAnimator());
rv.addItemDecoration(new ItemDecoration(this, LinearLayoutManager.VERTICAL));
for(i=0;i<DataModel.name.length;i++) {
alist = new ArrayList<DataSet>();
alist.add(new DataSet("Paytm",R.drawable.i));
alist.add(new DataSet("Facebook",R.drawable.i1));
alist.add(new DataSet("ShareIt",R.drawable.i2));
alist.add(new DataSet("Instagram",R.drawable.i3));
alist.add(new DataSet("BookMyShow",R.drawable.i4));
}
adap=new RecycledAdap(getApplicationContext(),alist);
rv.setAdapter(adap);
MyListener mlistener=new MyListener(getApplicationContext(),rv, new MyListener.ReClickListener() {
#Override
public void onClick(int position) {
Toast.makeText(getApplicationContext(),"Launching item"+position,Toast.LENGTH_SHORT).show();
LauncherHandler lh=new LauncherHandler(position);
String pkname=lh.getpack();
AppDialog adialog=new AppDialog();
adialog.packagenameset(pkname);
adialog.show(getFragmentManager(),"AppDialogFrag");
}
#Override
public void onLongClick(int position) {
LauncherHandler lh=new LauncherHandler(position);
String pkname=lh.getpack();
Toast.makeText(getApplicationContext(),"Launching item"+position,Toast.LENGTH_SHORT).show();
AppDialog adialog=new AppDialog();
adialog.packagenameset(pkname);
adialog.show(getFragmentManager(),"AppDialogFrag");
}
});
rv.addOnItemTouchListener(mlistener);
if (sharedPreferences!=null)
{
int x=sharedPreferences.getInt("Iconid",rid);
String y=sharedPreferences.getString("AppName",args);
addnow(y);
}
else
{
Toast.makeText(getApplication(),"There is nothing in app's cache",Toast.LENGTH_SHORT).show();
}
}
}
ListView code :
package com.example.mohitmehndiratta.customlistadap;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class AppList extends AppCompatActivity {
ListView lv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_list);
PackageManager pm=getPackageManager();
ArrayList<ApplicationInfo> li= (ArrayList<ApplicationInfo>) pm.getInstalledApplications(0);
ArrayList al=new ArrayList<String>();
String str;
String strpk;
ApplicationInfo info;
for(int i=0;i<li.size();i++)
{
info=li.get(i);
str=info.loadLabel(pm).toString();
Drawable appicon=info.loadIcon(pm);
al.add(str);
}
lv=(ListView)findViewById(R.id.listView);
final ArrayAdapter adap=new ArrayAdapter<String>(this,R.layout.support_simple_spinner_dropdown_item,al);
lv.setAdapter(adap);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
String text=lv.getItemAtPosition(i).toString();
Toast.makeText(getApplicationContext(),text+i,Toast.LENGTH_SHORT).show();
MainActivity.addnow(text);
}
});
}
}

How can I change the text of my Button from my TimePickerFragment class?

I started experimenting with time and date pickers in Andrioid.
My classes are as follows:
Main.java
package com.valgriz.testapplication2;
import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
public class Main extends FragmentActivity implements OnClickListener,
OnItemSelectedListener {
Button bPickTime;
Button bPickDate;
Spinner sTime;
TimePickerFragment tpf;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bPickTime = (Button) findViewById(R.id.bPickTime);
bPickDate = (Button) findViewById(R.id.bPickDate);
sTime = (Spinner) findViewById(R.id.sTime);
bPickTime.setOnClickListener(this);
bPickDate.setOnClickListener(this);
sTime.setOnItemSelectedListener(this);
ArrayAdapter sAdapter = ArrayAdapter.createFromResource(this,
R.array.sChoices1, android.R.layout.simple_spinner_item);
sAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sTime.setAdapter(sAdapter);
}
public void onClick(View v) {
if (v.getId() == R.id.bPickTime) {
DialogFragment df = new TimePickerFragment();
df.show(getSupportFragmentManager(), "timePickerFragment");
} else if (v.getId() == R.id.bPickDate) {
DialogFragment df = new DatePickerFragment();
df.show(getSupportFragmentManager(), "datePickerFragment");
}
}
public void onItemSelected(AdapterView<?> arg0, View v, int selection,
long identification) {
}
public void onNothingSelected(AdapterView<?> arg0) {
}
}
TimePickerFragment.java
package com.valgriz.testapplication2;
import java.util.Calendar;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.format.DateFormat;
import android.widget.Button;
import android.widget.TimePicker;
import android.widget.Toast;
public class TimePickerFragment extends DialogFragment implements
OnTimeSetListener {
int hourOfDay;
int minute;
public Dialog onCreateDialog(Bundle savedInstanceState) {
Calendar c = Calendar.getInstance();
hourOfDay = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
return new TimePickerDialog(getActivity(), this, hourOfDay, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
}
}
How can I set the text of bPickTime to be the hour and minute of the day?
so the button will look like this "hourOfDay + ":" + minute"
Thanks,
-Steve
I suppose that the button is in some layout file eg. main.xml. To access the view of any layout file that you haven't set using setContentView(), you need to inflate that particular layout and then access it's view.
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.main, null);
Button button = (Button) view.findViewById(R.id.button);
Now you can use that button however you want.
Declare and initialize the Button in TimePickerFragment.java exactly like you did in Main.java, then use
bPickTime.setText(hourOfDay + ":" + minute);

Categories

Resources