NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

public class MainActivity extends ActionBarActivity {
Spinner spinner,spinner2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinner = (Spinner) findViewById(R.id.ids_spinner);
spinner2 = (Spinner) findViewById(R.id.ids_spinner2);
getSpinner1();
}
private void getSpinner1() {
List<Header> headers = new ArrayList<Header>();
headers.add(new BasicHeader("Accept", "application/json"));

RestClient1.getByIdForSpinner(MainActivity.this, "myRestService/category", headers.toArray(new Header[headers.size()]), null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
ArrayList<String> spinnerArray = new ArrayList<String>();
final SpinnerAdapter spinnerAdapter = new SpinnerAdapter(MainActivity.this, spinnerArray);

for (int i = 0; i < response.length(); i++) {
try {
JSONObject c = response.getJSONObject(i);
String crArray = c.getString("c_Name");
spinnerAdapter.add(crArray);
}
catch (JSONException e) {
e.printStackTrace();
}
}

spinnerAdapter.add("Select One");
spinner.setAdapter(spinnerAdapter);
spinner.setSelection(spinnerAdapter.getCount());
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
parent.getItemAtPosition(position).toString();
getSpinner2(id);

Log.d("Callback", "onSuccess response");
}

@Override
public void onNothingSelected(AdapterView<?> parent) {
//Another interface callback
}
});
}
});
}

private void getSpinner2(Long id) {

List<Header> headers = new ArrayList<Header>();
headers.add(new BasicHeader("Accept", "application/json"));

RestClient2.getByCrForSpinner(MainActivity.this, "myRestService/products/" + id,
headers.toArray(new Header[headers.size()]), null, new JsonHttpResponseHandler() {

@Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response) { Log.d("Callback3", "3");

ArrayList<String> spinnerArray2 = new ArrayList<String>();
final SpinnerAdapter2 spinnerAdapter2 = new SpinnerAdapter2(MainActivity.this, spinnerArray2);
Log.d("Callback4", "4");

for (int i = 0; i < response.length(); i++) {
try {
JSONObject c = response.getJSONObject(i);
String prArray = c.getString("product_name");
spinnerAdapter2.add(prArray);
}
catch (JSONException e) {
e.printStackTrace();
}
}
Log.d("Callback5", "5");

spinnerAdapter2.add("Select One");

spinner2.setAdapter(spinnerAdapter2);
spinner2.setSelection(spinnerAdapter2.getCount());

spinnerAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(parent.getContext(),
"OnItemSelectedListener : " + parent.getItemAtPosition(position).toString(),
Toast.LENGTH_SHORT).show();
parent.getItemAtPosition(position).toString();
Log.d("Callback2", "onSuccess response2");

}
@Override
public void onNothingSelected(AdapterView<?> parent) {
//Another interface callback
}
});
}
});
}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.