Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:00:41+00:00 2026-06-12T16:00:41+00:00

I am working on an android app and using Fragments in UI layouts. In

  • 0

I am working on an android app and using Fragments in UI layouts. In one of the fragments i needed to use a datetime picker behind a button click. I downloaded a sample datetime picker application which was implemented using dialogs in activity and i was having trouble to get it to work behind button click which was in a fragment. So what i did i just called the datetime picker activity from that button using intent which displays the datetime picker in dialog. Now after setting the date and time using picker I want that on clicking ‘OK’ button i traverse back to that fragment which called this activity and update the selected Date and Time from picker in a textview. How to achieve that?

Note that datetime picker activity is different from the activity in which fragments are created.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:00:42+00:00Added an answer on June 12, 2026 at 4:00 pm

    Fragments also contains life cycle same as Activity.

    Just call finish() method from your Date picker activity.You will redirect to your last fragment,it will call onResume() of your fragment.And save your selected date in one static variable.

    Another approach:

    start your Date Picker activity

    like below

    int REC_CODE=2;
    startActivityForResult(new Intent(this,DataPic.class),REC_CODE);
    

    In DatePicker activity after selecting date

    write below code

    Intent i = new Intent();
    i.putExtra("date",selecteddate);
    setResult(RESULT_OK, i);
    finish(); 
    

    by excecuting above code it finishes DatePick activity
    then ovveride below method.

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) 
    {
    
      // TODO Auto-generated method stub
        if(requestCode == REQ_CODE){
                   if (resultCode == Activity.RESULT_OK){
                       String date= data.getStringExtra("date");
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Button Click of my Android App using Sencha Touch 2 is working fine in
I am working on an app for android using phonegap and unity. I wrote
I am working with Amazon In-app-purchases for Android on flash using native extentions. So,
I'm working on an Android app in which I would like to use multi-touch.
I am working on an android app that has a database in which one
Building an app using android.support.v4.app , targeting API level 8. Everything's working as planned
I'm working on an Android app that connects to .NET webservices. I use the
I am developing an Android app using Phonegap and jQueryMobile, working in Eclipse. I
I am working on an android app in which I am using some Native
I am working on an android app that has two activities. One is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.