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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:22:08+00:00 2026-06-15T01:22:08+00:00

Trying this again I have this samplet of code it is not complete but

  • 0

Trying this again

I have this samplet of code it is not complete but it should get my point accross

 public class MainActivity extends Activity {

    ListView list1;
    LazyAdapter adapter;
    String nUdid;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        final Context context = this;
        setContentView(R.layout.main);
        TextView viewtitle1 = (TextView) findViewById(R.id.textView1);

        JSONObject j = new JSONObject();
        try {
            j.put("action", "udid_get_products");
            j.put("success", "true");
            j.put("content", "udid product list");
            j.put("data", nUdid);
        } catch (JSONException e1) {
            e1.printStackTrace();
        }
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://www.xxxxxxxxx.com/yyyy/test.php");
    }
}

This snippet of code exists in the oncreate method

What I need to do is this

 public class MainActivity extends Activity {

    ListView list1;
    LazyAdapter adapter;
    String nUdid;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);
        myNewFunction();
    }


    public void myNewFunction() {
        final Context context = this;
        TextView viewtitle1 = (TextView) findViewById(R.id.textView1);

        JSONObject j = new JSONObject();
        try {
            j.put("action", "udid_get_products");
            j.put("success", "true");
            j.put("content", "udid product list");
            j.put("data", nUdid);
        } catch (JSONException e1) {
            e1.printStackTrace();
        }
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://www.xxxxxxxxx.com/yyyy/test.php");
    }
}

Will this work exactly as is or do I need to do something additional in the () following the function name myNewFunction. Is the snippet ‘Bundle savedInstanceState’ in the oncreate method needed in myNewFunction syntax or not.

  • 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-15T01:22:10+00:00Added an answer on June 15, 2026 at 1:22 am

    What you have should be just fine. You would only need to define the myNewFunction method to take a Bundle if you need to reference it in that method. Based upon your example, you currently do not need it in the myNewFunction method.

    But unless you need to call the myNewFunction method outside of your MainActivity, I would personally make it private.

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

Sidebar

Related Questions

This time I have an error which I have been trying again to figure
I've posted this before, but I worded it poorly. I'm trying again with a
Let me try ask this again with a code snippet with what I have
XML confuses me sometimes, but I'm trying to get this figured out. What the
I regret to ask this question again. I am trying to implement autocomplete on
Im trying this, but when i press it it dont changes, it only displays
So I'm trying this: inner.children('.image:not(dont):last-child').width(); What is the correct way to combine not(classname) and
Stuck again. :( I have the following code crammed into a procedure invoked when
Newbie Warning I have a simple but vexing problem trying to disable an NSButton.
considering that fairly static data should not be re-evaluated but cached instead, I wondered

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.