-
-
Save vivdub/683b84af9d01bf18fe3d to your computer and use it in GitHub Desktop.
psyhclo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setViews(int position, View view) { | |
cdh = new CallDataHelper(mContext); | |
if(mContext.getClass().equals((RatedCalls.class))){ | |
ratedCallsList = this.cdh.selectTopCalls(); | |
Log.i("MYLISTADAPTER", "size " + ratedCallsList.size()); | |
if (ratedCallsList != null) { | |
((TextView) view.findViewById(R.id.contact_name)).setText(ratedCallsList.get(position)[0]); | |
((TextView) view.findViewById(R.id.phone_number)).setText(ratedCallsList.get(position)[1]); | |
((TextView) view.findViewById(R.id.duration)).setText(ratedCallsList.get(position)[2]); | |
((TextView) view.findViewById(R.id.date)).setText(ratedCallsList.get(position)[3]); | |
} | |
}else if(mContext.getClass().equals(RatedContacts.class)){ | |
final PublishersBO listPublisher = (PublishersBO) mList.get(position); | |
if (listPublisher != null) { | |
//--setting list_item views | |
((TextView) view.findViewById(R.id.contact_name)).setText(listPublisher.getName()); | |
((TextView) view.findViewById(R.id.phone_number)).setText(listPublisher.getEmail()); | |
//--onClickListener | |
view.setOnClickListener(new OnClickListener() { | |
public void onClick(View arg0) { | |
Intent myIntent = new Intent(mContext,RatedContacts.class); | |
myIntent.putExtra("NAME", listPublisher.getName()); | |
myIntent.putExtra("ACTIVITY_NAME", mContext.getClass().toString()); | |
mContext.startActivity(myIntent); | |
mActivity.finish(); | |
} | |
}); | |
} | |
} | |
} | |
public ArrayList<String[]> selectTopCalls() { | |
ArrayList<String[]> list1 = new ArrayList<String[]>(); | |
Cursor cursor = this.db.query(TABLE_NAME, null, null, null, null, null, | |
"duration desc"); | |
if (cursor.moveToFirst()) { | |
do { | |
//if (cursor.getString(2) != "") { | |
cdObj = new CallData(); | |
String[] data = new String[4]; | |
data[0]=cursor.getString(2); | |
data[1]=cursor.getString(4); | |
data[2]=cursor.getString(5) | |
data[3]=cursor.getString(6); | |
list1.add(data); | |
} while (cursor.moveToNext()); | |
} | |
if (cursor != null && !cursor.isClosed()) { | |
cursor.close(); | |
} | |
return list1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this was created in order to help use pschylo, with his prob.....................