Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. android put loading message when load another acitvity

android put loading message when load another acitvity

Scheduled Pinned Locked Moved Android
androidtutorialquestion
4 Posts 2 Posters 12 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GongTji
    wrote on last edited by
    #1

    Hello everyone, First I'm new here once again hello all. Actually my question is very simple and I'm new in android, How to put loading message (whether text or progress bar) after user click on new activity, I have 2 activity both are: MainActivity and DashboardActivity Here's MainActivity code :

    public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    findViewById(R.id.textViewTest).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    finish();
    startActivity(new Intent(MainActivity.this, DashboardActivity.class));
    }
    });
    }
    }

    DashboardActivity

    public class DashboardActivity extends AppCompatActivity
    {
    private Toolbar mTopToolbar;
    private AppBarConfiguration mAppBarConfiguration;
    private NavigationView navigationView;
    private int progressStatus = 0;
    private Handler handler = new Handler();
    private ProgressBar progressBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity\_drawer);
    
        // Find the toolbar view inside the activity layout
        Toolbar toolbar = findViewById(R.id.toolbar);
        // Sets the Toolbar to act as the ActionBar for this Activity window.
        // Make sure the toolbar exists in the activity and is not null
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    
        DrawerLayout drawer = findViewById(R.id.drawer\_layout);
        navigationView = findViewById(R.id.nav\_view);
        View hview = navigationView.getHeaderView(0);
    
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.
        mAppBarConfiguration = new AppBarConfiguration.Builder(
                R.id.nav\_home, R.id.nav\_gallery, R.id.nav\_slideshow)
                .setOpenableLayout(drawer)
                .build();
        NavController navController = Navigation.findNavController(this, R.id.nav\_host\_fragment);
        NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
        NavigationUI.setupWithNavController(navigationView, navController);
    }
    
    D 1 Reply Last reply
    0
    • G GongTji

      Hello everyone, First I'm new here once again hello all. Actually my question is very simple and I'm new in android, How to put loading message (whether text or progress bar) after user click on new activity, I have 2 activity both are: MainActivity and DashboardActivity Here's MainActivity code :

      public class MainActivity extends AppCompatActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      findViewById(R.id.textViewTest).setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
      finish();
      startActivity(new Intent(MainActivity.this, DashboardActivity.class));
      }
      });
      }
      }

      DashboardActivity

      public class DashboardActivity extends AppCompatActivity
      {
      private Toolbar mTopToolbar;
      private AppBarConfiguration mAppBarConfiguration;
      private NavigationView navigationView;
      private int progressStatus = 0;
      private Handler handler = new Handler();
      private ProgressBar progressBar;

      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity\_drawer);
      
          // Find the toolbar view inside the activity layout
          Toolbar toolbar = findViewById(R.id.toolbar);
          // Sets the Toolbar to act as the ActionBar for this Activity window.
          // Make sure the toolbar exists in the activity and is not null
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayShowTitleEnabled(false);
      
          DrawerLayout drawer = findViewById(R.id.drawer\_layout);
          navigationView = findViewById(R.id.nav\_view);
          View hview = navigationView.getHeaderView(0);
      
          // Passing each menu ID as a set of Ids because each
          // menu should be considered as top level destinations.
          mAppBarConfiguration = new AppBarConfiguration.Builder(
                  R.id.nav\_home, R.id.nav\_gallery, R.id.nav\_slideshow)
                  .setOpenableLayout(drawer)
                  .build();
          NavController navController = Navigation.findNavController(this, R.id.nav\_host\_fragment);
          NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
          NavigationUI.setupWithNavController(navigationView, navController);
      }
      
      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Are you saying that it takes 4-5 seconds to go from one activity to another within the same app?

      "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

      G 1 Reply Last reply
      0
      • D David Crow

        Are you saying that it takes 4-5 seconds to go from one activity to another within the same app?

        "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

        G Offline
        G Offline
        GongTji
        wrote on last edited by
        #3

        David Crow wrote:

        Are you saying that it takes 4-5 seconds to go from one activity to another within the same app?

        Yes, it because I used asynctask and cause frameskipping. But thanks for reply

        D 1 Reply Last reply
        0
        • G GongTji

          David Crow wrote:

          Are you saying that it takes 4-5 seconds to go from one activity to another within the same app?

          Yes, it because I used asynctask and cause frameskipping. But thanks for reply

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          GongTji wrote:

          ...because I used asynctask...

          Which is not shown in the code you provided.

          "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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups