parse json in custom list view base adapter











up vote
0
down vote

favorite












public class YourAdvertisement extends AppCompatActivity {



ArrayList<String> items = new ArrayList<String>();

String date = null;

String price = null;

String type2 = null;

String amount = null;
ListView listView;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


String url =uid + "&access_token=" + access_token + "&start=" + start + "&total=" + total + "&type=" + type + "&signature=" + hashkey;

StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
// s is the response from the server
//if success go to login page

if (s.contains("{"status_code":100,""))
{
try {
JSONObject json = new JSONObject(s);
JSONArray leaders= json.getJSONArray("listing");

// ArrayList<String> items = new ArrayList<String>();

for(int i=0;i<leaders.length(); i++){
JSONObject jsonas = leaders.getJSONObject(i);
date = jsonas.getString("date");
price = jsonas.getString("price");
type2 = jsonas.getString("type");
amount = jsonas.getString("amount");
items.add(date);
Log.d(date,"Output");

}


} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String>(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1, items);

listView.setAdapter(customAdapter);


Intent intent = new Intent(YourAdvertisement.this, Tabbed.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}

}



}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Toast.makeText(YourAdvertisement.this, "Some error occurred -> " + volleyError, Toast.LENGTH_LONG).show();
//This is to hide the keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
});
RequestQueue requestQueue = Volley.newRequestQueue(YourAdvertisement.this);
requestQueue.add(request);


}

class CustomAdapter extends BaseAdapter {

@Override
public int getCount() {
return date.length();
}

@Override
public Object getItem(int position) {
return null;
}

@Override
public long getItemId(int position) {
return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);

TextView buyTextView = (TextView)convertView.findViewById(R.id.buyTextView);
TextView buyValueTextView = (TextView)convertView.findViewById(R.id.buyValueTextView);
TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);



return convertView;
}


}


}



how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .










share|improve this question
























  • You are initializing an ArrayAdapter, then using an uninitialized customAdapter.
    – lionscribe
    Nov 5 at 2:41










  • @lionscribe can you share the code?
    – Sze Ko
    Nov 5 at 2:51










  • You need to initialize listView also before access that
    – Ashish Singhal
    Nov 5 at 4:01












  • First get it working with static text, then worry about json.
    – lionscribe
    Nov 5 at 4:32










  • can someone correct my code?
    – Sze Ko
    Nov 5 at 4:45















up vote
0
down vote

favorite












public class YourAdvertisement extends AppCompatActivity {



ArrayList<String> items = new ArrayList<String>();

String date = null;

String price = null;

String type2 = null;

String amount = null;
ListView listView;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


String url =uid + "&access_token=" + access_token + "&start=" + start + "&total=" + total + "&type=" + type + "&signature=" + hashkey;

StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
// s is the response from the server
//if success go to login page

if (s.contains("{"status_code":100,""))
{
try {
JSONObject json = new JSONObject(s);
JSONArray leaders= json.getJSONArray("listing");

// ArrayList<String> items = new ArrayList<String>();

for(int i=0;i<leaders.length(); i++){
JSONObject jsonas = leaders.getJSONObject(i);
date = jsonas.getString("date");
price = jsonas.getString("price");
type2 = jsonas.getString("type");
amount = jsonas.getString("amount");
items.add(date);
Log.d(date,"Output");

}


} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String>(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1, items);

listView.setAdapter(customAdapter);


Intent intent = new Intent(YourAdvertisement.this, Tabbed.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}

}



}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Toast.makeText(YourAdvertisement.this, "Some error occurred -> " + volleyError, Toast.LENGTH_LONG).show();
//This is to hide the keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
});
RequestQueue requestQueue = Volley.newRequestQueue(YourAdvertisement.this);
requestQueue.add(request);


}

class CustomAdapter extends BaseAdapter {

@Override
public int getCount() {
return date.length();
}

@Override
public Object getItem(int position) {
return null;
}

@Override
public long getItemId(int position) {
return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);

TextView buyTextView = (TextView)convertView.findViewById(R.id.buyTextView);
TextView buyValueTextView = (TextView)convertView.findViewById(R.id.buyValueTextView);
TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);



return convertView;
}


}


}



how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .










share|improve this question
























  • You are initializing an ArrayAdapter, then using an uninitialized customAdapter.
    – lionscribe
    Nov 5 at 2:41










  • @lionscribe can you share the code?
    – Sze Ko
    Nov 5 at 2:51










  • You need to initialize listView also before access that
    – Ashish Singhal
    Nov 5 at 4:01












  • First get it working with static text, then worry about json.
    – lionscribe
    Nov 5 at 4:32










  • can someone correct my code?
    – Sze Ko
    Nov 5 at 4:45













up vote
0
down vote

favorite









up vote
0
down vote

favorite











public class YourAdvertisement extends AppCompatActivity {



ArrayList<String> items = new ArrayList<String>();

String date = null;

String price = null;

String type2 = null;

String amount = null;
ListView listView;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


String url =uid + "&access_token=" + access_token + "&start=" + start + "&total=" + total + "&type=" + type + "&signature=" + hashkey;

StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
// s is the response from the server
//if success go to login page

if (s.contains("{"status_code":100,""))
{
try {
JSONObject json = new JSONObject(s);
JSONArray leaders= json.getJSONArray("listing");

// ArrayList<String> items = new ArrayList<String>();

for(int i=0;i<leaders.length(); i++){
JSONObject jsonas = leaders.getJSONObject(i);
date = jsonas.getString("date");
price = jsonas.getString("price");
type2 = jsonas.getString("type");
amount = jsonas.getString("amount");
items.add(date);
Log.d(date,"Output");

}


} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String>(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1, items);

listView.setAdapter(customAdapter);


Intent intent = new Intent(YourAdvertisement.this, Tabbed.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}

}



}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Toast.makeText(YourAdvertisement.this, "Some error occurred -> " + volleyError, Toast.LENGTH_LONG).show();
//This is to hide the keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
});
RequestQueue requestQueue = Volley.newRequestQueue(YourAdvertisement.this);
requestQueue.add(request);


}

class CustomAdapter extends BaseAdapter {

@Override
public int getCount() {
return date.length();
}

@Override
public Object getItem(int position) {
return null;
}

@Override
public long getItemId(int position) {
return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);

TextView buyTextView = (TextView)convertView.findViewById(R.id.buyTextView);
TextView buyValueTextView = (TextView)convertView.findViewById(R.id.buyValueTextView);
TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);



return convertView;
}


}


}



how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .










share|improve this question















public class YourAdvertisement extends AppCompatActivity {



ArrayList<String> items = new ArrayList<String>();

String date = null;

String price = null;

String type2 = null;

String amount = null;
ListView listView;


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


String url =uid + "&access_token=" + access_token + "&start=" + start + "&total=" + total + "&type=" + type + "&signature=" + hashkey;

StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
// s is the response from the server
//if success go to login page

if (s.contains("{"status_code":100,""))
{
try {
JSONObject json = new JSONObject(s);
JSONArray leaders= json.getJSONArray("listing");

// ArrayList<String> items = new ArrayList<String>();

for(int i=0;i<leaders.length(); i++){
JSONObject jsonas = leaders.getJSONObject(i);
date = jsonas.getString("date");
price = jsonas.getString("price");
type2 = jsonas.getString("type");
amount = jsonas.getString("amount");
items.add(date);
Log.d(date,"Output");

}


} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String>(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1, items);

listView.setAdapter(customAdapter);


Intent intent = new Intent(YourAdvertisement.this, Tabbed.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}

}



}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Toast.makeText(YourAdvertisement.this, "Some error occurred -> " + volleyError, Toast.LENGTH_LONG).show();
//This is to hide the keyboard
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
});
RequestQueue requestQueue = Volley.newRequestQueue(YourAdvertisement.this);
requestQueue.add(request);


}

class CustomAdapter extends BaseAdapter {

@Override
public int getCount() {
return date.length();
}

@Override
public Object getItem(int position) {
return null;
}

@Override
public long getItemId(int position) {
return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);

TextView buyTextView = (TextView)convertView.findViewById(R.id.buyTextView);
TextView buyValueTextView = (TextView)convertView.findViewById(R.id.buyValueTextView);
TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);



return convertView;
}


}


}



how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .how to parse json into base adapter custom list view ? Here is my code.Can anyone correctmy code?thank and appreciate .







android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 5 at 7:22

























asked Nov 5 at 2:14









Sze Ko

11




11












  • You are initializing an ArrayAdapter, then using an uninitialized customAdapter.
    – lionscribe
    Nov 5 at 2:41










  • @lionscribe can you share the code?
    – Sze Ko
    Nov 5 at 2:51










  • You need to initialize listView also before access that
    – Ashish Singhal
    Nov 5 at 4:01












  • First get it working with static text, then worry about json.
    – lionscribe
    Nov 5 at 4:32










  • can someone correct my code?
    – Sze Ko
    Nov 5 at 4:45


















  • You are initializing an ArrayAdapter, then using an uninitialized customAdapter.
    – lionscribe
    Nov 5 at 2:41










  • @lionscribe can you share the code?
    – Sze Ko
    Nov 5 at 2:51










  • You need to initialize listView also before access that
    – Ashish Singhal
    Nov 5 at 4:01












  • First get it working with static text, then worry about json.
    – lionscribe
    Nov 5 at 4:32










  • can someone correct my code?
    – Sze Ko
    Nov 5 at 4:45
















You are initializing an ArrayAdapter, then using an uninitialized customAdapter.
– lionscribe
Nov 5 at 2:41




You are initializing an ArrayAdapter, then using an uninitialized customAdapter.
– lionscribe
Nov 5 at 2:41












@lionscribe can you share the code?
– Sze Ko
Nov 5 at 2:51




@lionscribe can you share the code?
– Sze Ko
Nov 5 at 2:51












You need to initialize listView also before access that
– Ashish Singhal
Nov 5 at 4:01






You need to initialize listView also before access that
– Ashish Singhal
Nov 5 at 4:01














First get it working with static text, then worry about json.
– lionscribe
Nov 5 at 4:32




First get it working with static text, then worry about json.
– lionscribe
Nov 5 at 4:32












can someone correct my code?
– Sze Ko
Nov 5 at 4:45




can someone correct my code?
– Sze Ko
Nov 5 at 4:45












1 Answer
1






active

oldest

votes

















up vote
0
down vote













      ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String> 
(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1,
items);
listView.setAdapter(customAdapter);

Above place change the adapter class
Declare the CustomAdapter in Globle declaration

CustomAdapter cm;


cm = new CustomAdapter (this,items);
listView.setAdapter(cm);

@Override
public Object getItem(int position) {
return date.length();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);


TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);

timeTextView.setText(date[position]);

return convertView;
}





share|improve this answer





















  • code is not working
    – Sze Ko
    Nov 5 at 7:15











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147461%2fparse-json-in-custom-list-view-base-adapter%23new-answer', 'question_page');
}
);

Post as a guest
































1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













      ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String> 
(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1,
items);
listView.setAdapter(customAdapter);

Above place change the adapter class
Declare the CustomAdapter in Globle declaration

CustomAdapter cm;


cm = new CustomAdapter (this,items);
listView.setAdapter(cm);

@Override
public Object getItem(int position) {
return date.length();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);


TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);

timeTextView.setText(date[position]);

return convertView;
}





share|improve this answer





















  • code is not working
    – Sze Ko
    Nov 5 at 7:15















up vote
0
down vote













      ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String> 
(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1,
items);
listView.setAdapter(customAdapter);

Above place change the adapter class
Declare the CustomAdapter in Globle declaration

CustomAdapter cm;


cm = new CustomAdapter (this,items);
listView.setAdapter(cm);

@Override
public Object getItem(int position) {
return date.length();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);


TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);

timeTextView.setText(date[position]);

return convertView;
}





share|improve this answer





















  • code is not working
    – Sze Ko
    Nov 5 at 7:15













up vote
0
down vote










up vote
0
down vote









      ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String> 
(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1,
items);
listView.setAdapter(customAdapter);

Above place change the adapter class
Declare the CustomAdapter in Globle declaration

CustomAdapter cm;


cm = new CustomAdapter (this,items);
listView.setAdapter(cm);

@Override
public Object getItem(int position) {
return date.length();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);


TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);

timeTextView.setText(date[position]);

return convertView;
}





share|improve this answer












      ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String> 
(YourAdvertisement.this, android.R.layout.simple_expandable_list_item_1,
items);
listView.setAdapter(customAdapter);

Above place change the adapter class
Declare the CustomAdapter in Globle declaration

CustomAdapter cm;


cm = new CustomAdapter (this,items);
listView.setAdapter(cm);

@Override
public Object getItem(int position) {
return date.length();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.adapter_view_layout,null);


TextView timeTextView = (TextView)convertView.findViewById(R.id.timeTextView);

timeTextView.setText(date[position]);

return convertView;
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 5 at 6:19









suresh madaparthi

1439




1439












  • code is not working
    – Sze Ko
    Nov 5 at 7:15


















  • code is not working
    – Sze Ko
    Nov 5 at 7:15
















code is not working
– Sze Ko
Nov 5 at 7:15




code is not working
– Sze Ko
Nov 5 at 7:15


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147461%2fparse-json-in-custom-list-view-base-adapter%23new-answer', 'question_page');
}
);

Post as a guest




















































































這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini