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 8876535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:14:13+00:00 2026-06-14T19:14:13+00:00

Right now i am consuming one web service in android.That web service is having

  • 0

Right now i am consuming one web service in android.That web service is having two input values
namely 01/01/2012 and 07/07/2012 respectively.

After clicking the invoke button and after providing these as input values,my project will show some bar-charts.Well its working fine.Here i am using two edit-text boxes for getting those input values.

But i would like to use Date-picker widget instead of using edit-text boxes.So i have dragged the date-picker widget and i did some code.

But now the problem is, the input values are fully off numeric and backslash right?
But in the date-picker widget it showing the input values in the combination of characters and numeric,but i need to use only the date-picker widget.

The date-picker widget is in this format dd-mm-yyyy eg:- 01-jan-1990

but i need to convert the above format in to 01/01/1990. How to do this?

please find my sources for references

Chart.java

public class Chart extends Activity 
{
//EditText edt1, edt2;

DatePicker dp1,dp2;

TextView txtv1;
Button btn;
Bundle data;

String[] orderNo = new String[20];
int[] freightRate = new int[20];
int[] marginPercent = new int[20];

@Override
public void onCreate(Bundle savedInstanceState)     {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    dp1 = (DatePicker) findViewById(R.id.datePicker_one);
    dp2 = (DatePicker) findViewById(R.id.datePicker_Two);

    String res_1 = dp1.getDayOfMonth()+"/"+dp1.getMonth()+"/"+dp1.getYear();
            String res_2 = dp2.getDayOfMonth()+"/"+dp2.getMonth()+"/"+dp2.getYear();   


            btn = (Button) findViewById(R.id.button1);
    btn.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            getTMSChart(dp1.getYear(), dp2.getYear());
            Intent intnt = new Intent(v.getContext(), BarGraphActivity.class);
            intnt.putExtras(data);

            startActivity(intnt);
        }
    });
}

public void getTMSChart(int j, int k) 
{

    System.setProperty("http.keepAlive", "false");
    SoapSerializationEnvelope envelope = new   SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.dotNet = true;

    String METHOD = "GetTMSChart";
    String NAMESPACE = "http://tempuri.org/";
    String SOAP_ACTION = "http://tempuri.org/GetTMSChart";
    String URL = "http://54.251.60.177/TMSOrdersService/TMSDetails.asmx";

    SoapObject request = new SoapObject(NAMESPACE, METHOD);

    request.addProperty("FromDate", j);
    request.addProperty("ToDate", k);
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapObject result = (SoapObject) envelope.bodyIn;
        SoapObject root = (SoapObject) ((SoapObject) (result).getProperty(0)).getProperty("NewDataSet");
        int tablesCount = root.getPropertyCount();

        data = new Bundle();

    for (int i = 0; i < tablesCount; i++) {

    SoapObject table = (SoapObject) root.getProperty(i);
    orderNo[i] = table.getPropertyAsString("Order_No");
    freightRate[i] = Integer.parseInt(table.getPropertyAsString("Freight_Rate"));
    marginPercent[i] = Integer.parseInt(table.getPropertyAsString("Margin_Percent"));               

  /*Toast.makeText(getApplicationContext(), "Order No:" + orderNo[i] + "\nFreigtRate:" +     freightRate[i] + "\nMarginPc:" + marginPercent[i], Toast.LENGTH_SHORT).show();*/
        }
        data.putStringArray("orderno", orderNo);
        data.putIntArray("freightrate", freightRate);
        data.putIntArray("marginpercent", marginPercent);
        data.putInt("count",tablesCount);
    }
catch (Exception e) 
{
    Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    e.printStackTrace();
    }   } }

BarGraphActivity.java

public class BarGraphActivity extends Activity {

String[] orderNo = new String[20];
int[] freightRate = new int[20];
int[] marginPercent = new int[20];
int count;
RelativeLayout rltv;

@Override
    public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main1);

    final GraphicalView grfv = createIntent(); 

    RelativeLayout rltv = (RelativeLayout)findViewById(R.id.rlyot);
    rltv.addView(grfv);
}

public GraphicalView createIntent()
{
    rltv = (RelativeLayout)findViewById(R.id.rlyot);

    String[] titles = new String[] { "Order's profit of the year", " " };

    Bundle idata = getIntent().getExtras();
    if (idata !=null)
    {
        orderNo = idata.getStringArray("orderno");  
        freightRate = idata.getIntArray("freightrate");
        marginPercent = idata.getIntArray("marginpercent");
        count = idata.getInt("count");

        CategorySeries series = new CategorySeries("Order-FreightRate Graph");

        for ( int i = 0; i < count; i++)
        {
            series.add(orderNo[i], freightRate[i]);


            Thread th = new Thread();
            try 
            {
                Thread.sleep(2000);
                }
            catch (InterruptedException e) 
            {
                e.printStackTrace();
            }
        }


        XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
        dataset.addSeries(series.toXYSeries());

        XYSeriesRenderer renderer = new XYSeriesRenderer();
        renderer.setDisplayChartValues(true);

        //renderer.setChartValuesSpacing(1);

        XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
        mRenderer.addSeriesRenderer(renderer);

        mRenderer.setXLabelsColor(Color.WHITE);
        mRenderer.setYLabelsColor(0,Color.WHITE);

        mRenderer.setZoomButtonsVisible(true);

        mRenderer.setApplyBackgroundColor(true);
        mRenderer.setBackgroundColor(Color.parseColor("#000000"));

        mRenderer.setBarSpacing(0.7f);

    //  mRenderer.setChartTitleTextSize(20);
    //  mRenderer.setLabelsTextSize(25);
    //  mRenderer.setMarginsColor(Color.WHITE);

final GraphicalView grfv =  ChartFactory.getBarChartView(BarGraphActivity.this, dataset, mRenderer, Type.DEFAULT);
    return grfv;
    }
    return null;
    }
}

Any idea?

Thanks for your precious time!..

  • 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-14T19:14:14+00:00Added an answer on June 14, 2026 at 7:14 pm

    How about this:

    You keep the text fields and when the textfeild is selected a DateTime Picker dialog appears, and the textfield retains the datetime format.

    final Calendar c = Calendar.getInstance();
    mYear = c.get(Calendar.YEAR);
    mMonth = c.get(Calendar.MONTH);
    mDay = c.get(Calendar.DAY_OF_MONTH);
    updateDisplay();
    

    and in the update display method:

    private void updateDisplay() {
        checkdate.setText(
                new StringBuilder()
                // Month is 0 based so add 1
                .append(mMonth + 1).append("-")
                .append(mDay).append("-")
                .append(mYear).append(" "));
    }
    

    Also add to the Activity

    @Override
    protected Dialog onCreateDialog(int id) {
        // TODO Auto-generated method stub
        switch (id) {
        case DATE_DIALOG_ID:
            return new DatePickerDialog(this,
                    mDateSetListener,
                    mYear, mMonth, mDay);
     }
    }
    @Override
    protected void onPrepareDialog(int id, Dialog dialog) {
        // TODO Auto-generated method stub
        switch (id) {
        case DATE_DIALOG_ID:
            ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay);
            break;
        }
    }
    private DatePickerDialog.OnDateSetListener mDateSetListener =
        new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                int dayOfMonth) {
            // TODO Auto-generated method stub
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;
            updateDisplay();
        }
    };
    

    And add the Focus listener to the textfield

    textfield1.setOnFocusChangeListener(new OnFocusChangeListener(){
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                // TODO Auto-generated method stub
                if(hasFocus){
                    showDialog(DATE_DIALOG_ID);
                }
            }
        });
    

    Hope its what you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now i am working with consuming web service from android by the method
i am self-leaner to android.Right now i am consuming web service in android eclipse
Right now i am consuming two webservices by the method SOAP on android.The way
Right now I have a script that will get the last five files in
Right now I have a function, in a class that is used to listen
I'm developing my firs app for android right now, I am using multiple tables
I right now have a problem that is rather confusing to me: I have
Slightly stumped right now and was wondering if the community could give me that
Right now I have an upload field while uploads files to the server. The
Right now, I have: RewriteRule ^([^/\.]+)?$ index.php?id=$1 [L] to match any username at 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.