I need to add one custom header for before making a sip call. please help me.
Thanks in advance.
Finally i got the answer for my question. You should change your make makeSipCall() method.
private boolean makeSipCall(String phoneNumber)
{
if(!created)
return false;
Log.i("MtaAPIImpl", (new StringBuilder("makecall : ")).append(phoneNumber).toString());
phoneNumber = (new StringBuilder("<sip:")).append(phoneNumber).append("#").append(sipServer).append(">").toString();
byte userData[] = new byte[1];
int callId[] = new int[1];
pjsua_call_setting cs = new pjsua_call_setting();
pjsua.call_setting_default(cs);
cs.setVid_cnt(0L);
cs.setAud_cnt(1L);
cs.setFlag(0L);
pjsua_msg_data msgData = new pjsua_msg_data();
pjsua.msg_data_init(msgData);
pj_pool_t pool = pjsua.pool_create("call_tmp", 512L, 512L);
pjsua.csipsimple_init_acc_msg_data(pool, 1, msgData);
pj_str_t uri = pjsua.pj_str_copy(phoneNumber);
//Here adding headers adding through bundel.
Bundle extra_header = new Bundle();
final Bundle b = new Bundle();
extra_header.putString("header-Name", "Header-Value");
b.putBundle(SipCallSession.OPT_CALL_EXTRA_HEADERS, extra_header);
Bundle extraHeaders = b.getBundle(SipCallSession.OPT_CALL_EXTRA_HEADERS);
for (String key : extraHeaders.keySet()) {
try {
String value = extraHeaders.getString(key.toString());
if (!TextUtils.isEmpty(value)) {
int res = pjsua.csipsimple_msg_data_add_string_hdr(pool, msgData,pjsua.pj_str_copy(key), pjsua.pj_str_copy(value));
if (res == pjsuaConstants.PJ_SUCCESS) {
Log.e(THIS_FILE, "Failed to add Xtra hdr (" + key + " : "+ value + ") probably not X- header");
}
}
} catch (Exception e) {
Log.e(THIS_FILE, "Invalid header value for key : " + key);
}
}
int status = pjsua.call_make_call(1, uri, cs, userData, msgData, callId);
pjsua.pj_pool_release(pool);
return status == pjsuaConstants.PJ_SUCCESS;
}
Related
I have tried searching for the error but i can't seem to link the results i find to my application.
Here is the error i get whenever i run my program.
Unhandled Exception:
System.NotSupportedException: Could not activate JNI Handle
0x7fec3e5620 (key_handle 0xe1ccda9) of Java
type 'md5ca0dbb1ec41706184e899fc3d5b0057e/MainActivity'
as managed type 'PowerCellShipping3.MainActivity'. occurred
Here is my c# code. I am unsure what is actually causing the error as i have never come across this error(obviously.)
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
scan = FindViewById<Button>(Resource.Id.btnScan);
lbviewScan = FindViewById<ListView>(Resource.Id.lvbScanned);
lbviewReject = FindViewById<ListView>(Resource.Id.lbRejected);
tvscanned = FindViewById<TextView>(Resource.Id.textView4);
tvreject = FindViewById<TextView>(Resource.Id.textView5);
etLot = FindViewById<EditText>(Resource.Id.etLotNumber);
scan.Click += delegate {
//Call Your Method When User Clicks The Button
btnClick();
};
}
/**************************************************************************************************************************************************************/
public class ToDoTasks
{
[PrimaryKey, AutoIncrement, Column("#Lot_Number")]
public int Id { get; set; }
[MaxLength(100)]
public string Task { get; set; }
}
public List<string> GetData()
{
var db = new SQLiteConnection("Data Source = obdbnsql3; Persist Security Info=True;User ID = sa" + "Password=P0w3r1T");
List<string> data = new List<string>();
foreach (var item in db.Table<ToDoTasks>())
{
var objectItem = item.Task.ToString();
data.Add(objectItem);
}
return data;
}
/***************************************************************************************************************************************************************/
public void btnClick()
{
sql1 = "update [Otto_Internal_Apps].[dbo].[Shipping_Detail] set [Box_Scanned] = 1, [Shipment_Scan_Date] = GETDATE(), [Box_Rejected] = 0 " +
"where [Lot_No] = #Lot_Number and ([Box_Rejected] != 1 or [Box_Rejected] is null)";
SQLiteCommand sqlCommand = new SQLiteCommand(connection);
sqlCommand.CommandText.Replace(sql1,sql1);
string attempt = sql1;
int iCount = Convert.ToInt32(attempt);
sqlCommand.CommandText.Remove(iCount,iCount);
/********************************************************************************************************************************/
string attempt2 = "#Lot_Number";
int iCount2 = Convert.ToInt32(attempt2);
//sqlCommand.Parameters.AddWithValue("#Lot_number", etLot.Text);
sqlCommand.CommandText.Insert(iCount2, etLot.Text);
/********************************************************************************************************************************/
try
{ // Execute the query and return the rows affected
sql2 = "select top 1 * from [Otto_Internal_Apps].[dbo].[Shipping_Detail] where [Lot_No] = #Lot_Number and [Box_Rejected] = 1";
int iRowsAffected = sqlCommand.ExecuteNonQuery();
// if the rows affected is zero then the lot no. does not exist and must be inserted as a rejected scan
if (iRowsAffected == 0)
{
sqlCommand.CommandText = sql2;
sql3 = "INSERT INTO [Otto_Internal_Apps].[dbo].[Shipping_Detail] ([Lot_No],[Box_Rejected]) VALUES(#Lot_Number, 1) ";
//lbviewScan.Load(sqlCommand.ExecuteQuery);
var items = GetData();
var listView = FindViewById<ListView>(Resource.Id.lvbScanned);
listView.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, items);
if (lbviewScan.Count == 0)
{
sqlCommand.CommandText = sql3;
string attempt3 = sql3;
int iCount3 = Convert.ToInt32(attempt3);
sqlCommand.CommandText.Remove(iCount3, iCount3);
string attempt4 = "#Lot_Number";
int iCount4 = Convert.ToInt32(attempt4);
sqlCommand.CommandText.Insert(iCount4, etLot.Text);
sqlCommand.ExecuteNonQuery();
}
//int iItemFound = lbviewReject.Items.IndexOf(etLot.Text);
int iItemFound = itemList.IndexOf(etLot.Text);
if (iItemFound == -1)
{
//lbviewReject.Items.Add(etLot.Text);
itemList.Add(etLot.Text);
}
}
else
{
//int iItemFound = lbviewScan.Items.IndexOf(etLot.Text);
int iItemFound = itemList.IndexOf(etLot.Text);
if (iItemFound == -1)
{
//lbviewScan.Items.Add(etLot.Text);
itemList.Add(etLot.Text);
}
Console.Beep(800, 200);
}
}
catch (SQLException sqle)
{
Toast.MakeText(ApplicationContext, sqle.Message, ToastLength.Long).Show();
Console.Beep(2000, 1600);
return;
}
The other posts that I saw on the Xamarin site seemed to be similar errors but like i said before, I still can't find a solution.
I think that the error could be caused due to one of the listboxes but i am unsure about that.
Any help would be greatly appreciated. Thanks
I'm having a problem updating data from SQLite when API response are success, for example, I have 5 pending data, My codes are getting and sending data from database. but only the last data had update in SQLite. I have logged ticket_tick_no_delayedinside onResponse and this is what I've get. any insights?.
Please take a look at my code:
private void checkingUnsendData() {
String query = ("select * from tickets where is_send = '2' or is_send = '0' ");
Cursor c = sqldb.rawQuery(query, null);
if (c != null && c.moveToFirst()) {
while (!c.isAfterLast()) {
trip_no_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_TRIP_NO));
ticket_control_no_delayed = c.getString(c.getColumnIndex(DBHelper.CONTROL_NO));
ticket_tick_no_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_NO));
ticket_datetime_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_DATETIME));
ticket_kmfrom_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_KMFROM));
ticket_kmto_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_KMTO));
ticket_placefrom_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_PLACEFROM));
ticket_placeto_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_PLACETO));
ticket_amount_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_AMOUNT));
ticket_discount_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_DISCOUNT));
transaction_type_delayed = c.getString(c.getColumnIndex(DBHelper.TRANSACTION_TYPE));
passenger_type_delayed = c.getString(c.getColumnIndex(DBHelper.PASSENGER_TYPE));
ticket_lat_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_LAT));
ticket_long_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_LONG));
device_serial_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_DEVICE_SERIAL));
sendUnsendData();
c.moveToNext();
}
}
c.close();
}
private void sendUnsendData() {
JSONObject params = new JSONObject();
try {
params.put("control_no", ticket_control_no_delayed);
params.put("trip_no", trip_no_delayed);
params.put("ticket_no", ticket_tick_no_delayed);
params.put("ticket_datetime", ticket_datetime_delayed);
params.put("ticket_kmfrom", ticket_kmfrom_delayed);
params.put("ticket_kmto", ticket_kmto_delayed);
params.put("ticket_placefrom", ticket_placefrom_delayed);
params.put("ticket_placeto", ticket_placeto_delayed);
params.put("amount", ticket_amount_delayed);
params.put("discount", ticket_discount_delayed);
params.put("trans_type", transaction_type_delayed);
params.put("passenger_type", passenger_type_delayed);
params.put("lat", ticket_lat_delayed);
params.put("long", ticket_long_delayed);
params.put("device_serial", device_serial_delayed);
AndroidNetworking.post("MY_LINK.COM")
.addJSONObjectBody(params)
.addHeaders("Content-Type", "application/json")
.addHeaders("Prefer", "return=representation")
.setPriority(Priority.HIGH)
.build()
.getAsJSONArray(new JSONArrayRequestListener() {
#Override
public void onResponse(JSONArray response) {
String qu = ("update tickets set is_send = '1' where ticket_tick_no = '" + ticket_tick_no_delayed + "'");
sqldb.execSQL(qu);
Log.e("ticket_tick_no_delayed", ticket_tick_no_delayed);
}
#Override
public void onError(ANError error) {
// handle error
asd(error);
}
});
} catch (Throwable e) {
e.printStackTrace();
}
}
EDIT
I've put log after the params.put... and I'm getting the data successfully.
see the image below:
I have resolved it by using List<String> array = new ArrayList<>();.
When I'm passing the data from SQLite, I put array.add(); inside the looping.
this is the code:
`while (!c.isAfterLast()) {
trip_no_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_TRIP_NO));
ticket_control_no_delayed = c.getString(c.getColumnIndex(DBHelper.CONTROL_NO));
ticket_tick_no_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_NO));
ticket_datetime_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_DATETIME));
ticket_kmfrom_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_KMFROM));
ticket_kmto_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_KMTO));
ticket_placefrom_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_PLACEFROM));
ticket_placeto_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_PLACETO));
ticket_amount_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_AMOUNT));
ticket_discount_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_DISCOUNT));
transaction_type_delayed = c.getString(c.getColumnIndex(DBHelper.TRANSACTION_TYPE));
passenger_type_delayed = c.getString(c.getColumnIndex(DBHelper.PASSENGER_TYPE));
ticket_lat_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_LAT));
ticket_long_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_LONG));
device_serial_delayed = c.getString(c.getColumnIndex(DBHelper.TICKET_DEVICE_SERIAL));
array.add(ticket_tick_no_delayed); // additional code
sendUnsendData();
c.moveToNext();
}`
After getting all the data, If the Response from AndroidNetworking has succeed, I put for each loop on OnResponse and using the List that I've used.
Take a look at it:
for (String value: array) {
String qu = ("update tickets set is_send = '1' where ticket_tick_no = '" + value + "'");
sqldb.execSQL(qu);
}
I am trying to add Oauth1 Authorization in my android app using volley
in the postman when i add the details like oauth_consumer_key, oauth_consumer_secret , token_key token_secret like the picture below
it generate a header like below picture and response received successfully.
Postman generated header
Authorization:OAuth oauth_consumer_key="4e77abaec9b6fcda9kjgkjgh44c2e1",oauth_token="2da9439r34104293b1gfhse2feaffca9a1",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1482470443",oauth_nonce="cCbH5b",oauth_version="1.0",oauth_signature="A1QPwTATVF4x3cN0%2FN46CZrtSKw%3D"
Problem
I googled a lot to create oauth signature like postmasn created to attach volley ServerConnectionChannel but failed.
oauth_signature="A1QPwTATVF4x3cN0%2FN46CZrtSKw%3D"
Current code
public void doSendJsonRequest(final ERequest ERequest) {
requestMethod = String.valueOf(ERequest.method);
requestUrl = String.valueOf(ERequest.mReqUrl);
if(requestMethod.equals(Request.Method.GET)){
requestMethod = "GET";
}else if(requestMethod.equals(Request.Method.POST)){
requestMethod = "POST";
}else if(requestMethod.equals(Request.Method.PUT)){
requestMethod = "PUT";
}else if(requestMethod.equals(Request.Method.DELETE)){
requestMethod = "DELETE";
}
Long tsLong = System.currentTimeMillis()/1000;
final String ts = tsLong.toString();
final String kk = requestMethod+"&" + encode(requestUrl)+"&";
final String kk = encode("GET"+"&"
+ requestUrl+"&"
+ OAUTH_CONSUMER_KEY + "=\"4e77abaec9b6fcda9b11e89a9744c2e1\"&"
+OAUTH_NONCE + "=\"" + getNonce()+ "\"&"
+OAUTH_SIGNATURE_METHOD + "=\""+OAUTH_SIGNATURE_METHOD_VALUE+"\"&"
+OAUTH_TIMESTAMP + "=\"" + ts + "\"&"
+OAUTH_TOKEN +"=\"2da943934104293b167fe2feaffca9a1\"");
RequestQueue queue = VolleyUtils.getRequestQueue();
try {
JSONObject jsonObject = ERequest.jsonObject;
EJsonRequest myReq = new EJsonRequest(ERequest.method, ERequest.mReqUrl, jsonObject, createReqSuccessListener(ERequest), createReqErrorListener(ERequest)) {
public Map < String, String > getHeaders() throws AuthFailureError {
// Long tsLong = System.currentTimeMillis()/1000;
// String ts = tsLong.toString();
String strHmacSha1 = "";
String oauthStr = "";
strHmacSha1 = generateSignature(kk, oAuthConsumerSecret, oAuthTokenSecret);
strHmacSha1 = toSHA1(strHmacSha1.getBytes());
Log.e("SHA !",strHmacSha1);
oauthStr ="OAuth "+ OAUTH_CONSUMER_KEY + "=\"4e77abaec9b6fcda9b11e89a9744c2e1\","
+OAUTH_TOKEN +"=\"2da943934104293b167fe2feaffca9a1\","
+OAUTH_SIGNATURE_METHOD + "=\""+OAUTH_SIGNATURE_METHOD_VALUE+"\","
+OAUTH_TIMESTAMP + "=\"" + ts + "\","
+OAUTH_NONCE + "=\"" + getNonce()+ "\","
+OAUTH_VERSION + "=\"" + OAUTH_VERSION_VALUE + "\","
+OAUTH_SIGNATURE + "=\"" + strHmacSha1+ "\"";
Log.e("VALUE OF OAuth str",oauthStr);
Map<String, String> params = new HashMap<String, String>();
params.put("Content-Type", "application/json");
params.put("Authorization",oauthStr);
// params.put("Authorization",getConsumer().toString());
return params;
}
};
myReq.setRetryPolicy(new DefaultRetryPolicy(
DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 4,
BABTAIN_MAX_RETRIES,
BABTAIN_BACKOFF_MULT));
myReq.setHeader("Cache-Control", "no-cache");
//myReq.setHeader("Content-Type", "application/json");
queue.add(myReq);
} catch (Exception e) {
e.printStackTrace();
}
private String generateSignature(String signatueBaseStr, String oAuthConsumerSecret, String oAuthTokenSecret) {
byte[] byteHMAC = null;
try {
Mac mac = Mac.getInstance("HmacSHA1");
SecretKeySpec spec;
if (null == oAuthTokenSecret) {
String signingKey = encode(oAuthConsumerSecret) + '&';
spec = new SecretKeySpec(signingKey.getBytes(), "HmacSHA1");
} else {
String signingKey = encode(oAuthConsumerSecret) + '&' + encode(oAuthTokenSecret);
spec = new SecretKeySpec(signingKey.getBytes(), "HmacSHA1");
}
mac.init(spec);
byteHMAC = mac.doFinal(signatueBaseStr.getBytes());
} catch (Exception e) {
e.printStackTrace();
}
String base64 = Base64.encodeToString(byteHMAC, Base64.DEFAULT);
return base64.trim();
}
private String toSHA1(byte[] convertme) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
}
catch(NoSuchAlgorithmException e) {
e.printStackTrace();
}
return byteArrayToHexString(md.digest(convertme));
}
private String byteArrayToHexString(byte[] b) {
String result = "";
for (int i=0; i < b.length; i++)
result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );
return result;
}
this code create a signature like :oauth_signature="42a611860e29e893a435b555e7a9559a704f4e94" and it failed to get autherization.
getting error like : BasicNetwork.performRequest: Unexpected response code 401 for url
?How to generate oauth_signature like postman provided using volley..
?how can i improve this code ?Is any libraries or default function to do that
?How we add oauth1 signature in volley..
Please Help.. Thank you
I just found a github example for generating signature corresponding to nonce in Oauth1 and successfully integrate into my project
here is the link : https://github.com/rameshvoltella/WoocommerceAndroidOAuth1
I'm trying to pass a String between activities, From YtAdapter to Favorites.
YtAdapter:
mHolder.mVideoFavorite.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//////////////////////////////////////////////////////////////
// Need to send SearchResult result from here to favorites //
////////////////////////////////////////////////////////////
AppUtils.showToast(result.getSnippet().getTitle() + " Was added to favorites.");
Intent intent = new Intent(mActivity,Favorites.class);
String vidId,vidTitle,vidThumbnail;
vidId = result.getId().getVideoId(); //Video ID
vidTitle = result.getSnippet().getTitle(); //Video Title
vidThumbnail = result.getSnippet().getThumbnails().getMedium().getUrl(); //Video Thumbnail
intent.putExtra("id",vidId);
intent.putExtra("title",vidTitle);
intent.putExtra("thumbnail",vidThumbnail);
}
});
And try to get it in Favorites:
/*Getting video information from YtAdapter*/
vidID = getIntent().getStringExtra("id"); <--- Stays null
vidTitle = getIntent().getStringExtra("title"); <--- Stays null
vidThumbnail = getIntent().getStringExtra("thumbnail"); <--- Stays null
I'm accessing Favorties from 3rd activity, not straight from YtAdapter.
try this in your main class:
Intent i = new Intent(ListViewActivity.this, EditContact.class);
Bundle bundle = new Bundle();
bundle.putInt("index", itemId);
bundle.putBoolean("AddContact", false);
i.putExtras(bundle);
startActivity(i);
and you can get your data in the other class like this:
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
Int index = bundle.getInt("index");
Boolean bool = bundle.getBoolean("AddContact");
if (bool ) {
setTitle("Add Contact");
} else {
setTitle("Edit Contact");
}
I hope it will help.
you can force all of your parameter be a string value:
intent.putExtra("id",vidId +"");
intent.putExtra("title",vidTitle+"");
intent.putExtra("thumbnail",vidThumbnail+"");
probally they aren't and you are getting with "getStringExtra".
but the better options is you use te correct "getter" of extra.
---Edit---
you can check in your activity the keys and values this way:
for(String key : getIntent().getExtras().keySet()){
Log.d("TEST", "key: " + key);
Log.d("TEST", "value: " + getIntent().getExtras().get(key));
}
I am new to android here i am facing problem when i try to pass the retrived data from curser to bundle then i am not able to get the value of that variable.Below is my code please help me to come out from this situation.
Cursor cur3 = db3.rawQuery("SELECT * FROM " + TableName, null);
try {
db3 = this.openOrCreateDatabase("remoteid.db", MODE_PRIVATE, null);
if(cur3 != null )
{
if(cur3.moveToFirst())
{
do {
valueOfID = cur3.getString(cur3.getColumnIndex("PretestID"));
valuOfDate = cur3.getString(cur3.getColumnIndex("Date"));
textType = cur3.getString(cur3.getColumnIndex("txtVCT"));
valueOfDDLTS = cur3.getString(cur3.getColumnIndex("ddlTestingSession"));
valueOfReason = cur3.getString(cur3.getColumnIndex("txtReason"));
valueOfHowmany = cur3.getString(cur3.getColumnIndex("txthowmany"));
valueOftxtques1 = cur3.getString(cur3.getColumnIndex("txtques1"));
valueOfrblques2a = cur3.getString(cur3.getColumnIndex("rblques2a"));
valueOfrblques2b = cur3.getString(cur3.getColumnIndex("rblques2b"));
valueOfrblques3 = cur3.getString(cur3.getColumnIndex("rblques3"));
valueOftxtques4 = cur3.getString(cur3.getColumnIndex("txtques4"));
valueOfrblques5 = cur3.getString(cur3.getColumnIndex("rblques5"));
valueOfrblques6 = cur3.getString(cur3.getColumnIndex("rblques6"));
valueOfrblques7 = cur3.getString(cur3.getColumnIndex("rblques7"));
valueOfrblques8 = cur3.getString(cur3.getColumnIndex("rblques8"));
valueOfrblques9 = cur3.getString(cur3.getColumnIndex("rblques9"));
valueOfddlsick = cur3.getString(cur3.getColumnIndex("ddlsick"));
valueOftxtques11 = cur3.getString(cur3.getColumnIndex("txtques11"));
valueOfrblques12 = cur3.getString(cur3.getColumnIndex("rblques12"));
valueOftxtques13 = cur3.getString(cur3.getColumnIndex("txtques13"));
valueOftxtques14 = cur3.getString(cur3.getColumnIndex("txtques14"));
valueOfrblques15 = cur3.getString(cur3.getColumnIndex("rblques15"));
valueOfrblques16 = cur3.getString(cur3.getColumnIndex("rblques16"));
valueOfrblques17 = cur3.getString(cur3.getColumnIndex("rblques17"));
valueOftxtques18 = cur3.getString(cur3.getColumnIndex("txtques18"));
//Toast.makeText(getApplicationContext(), valueOftxtques18, Toast.LENGTH_SHORT).show();
}while (cur3.moveToNext());
}
}
}
catch(Exception e) {
Log.e("Error", "Error", e);
} finally {
if (db3 != null)
db3.close();
}
cur3.close();
arrayadapter11 = new simpleefficientadapter(Screening.this,prtestData);
arrayadapter22 = new simpleefficientadapter(Screening.this,screeningData);
arrayadapter33 = new simpleefficientadapter(Screening.this,postData);
mylist1.setAdapter(arrayadapter11);
mylist1.setOnItemClickListener(this);
mylist2.setAdapter(arrayadapter22);
mylist2.setOnItemClickListener(this);
mylist3.setAdapter(arrayadapter33);
mylist3.setOnItemClickListener(this);
}
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Intent intent;
switch (arg0.getId()) {
case R.id.prescreenlist:
intent = new Intent(getApplicationContext(), NewScreening.class);
Bundle bundle = new Bundle();
bundle.putString("DateValue", valuOfDate);
bundle.putString("TT", textType);
bundle.putString("idValue", valueOfID);
bundle.putString("ddltsValue", valueOfDDLTS);
bundle.putString("reasonValue", valueOfReason);
bundle.putString("howmanyValue", valueOfHowmany);
bundle.putString("textqus1Value", valueOftxtques1);
bundle.putString("textqus2aValue", valueOfrblques2a);
bundle.putString("textqus2bValue", valueOfrblques2b);
bundle.putString("rbqs3Value", valueOfrblques3);
bundle.putString("rbqs4Value", valueOftxtques4);
bundle.putString("rbqs5Value", valueOfrblques5);
bundle.putString("rbqs6Value", valueOfrblques6);
bundle.putString("rbqs7Value", valueOfrblques7);
bundle.putString("rbqs8Value", valueOfrblques8);
bundle.putString("rbqs9Value", valueOfrblques9);
bundle.putString("ddlsValue", valueOfddlsick);
bundle.putString("tq11Value", valueOftxtques11);
bundle.putString("tq12Value", valueOfrblques12);
bundle.putString("tq13Value", valueOftxtques13);
bundle.putString("tq14Value", valueOftxtques14);
bundle.putString("rbqs15Value", valueOfrblques15);
bundle.putString("rbqs16Value", valueOfrblques16);
bundle.putString("rbqs17Value", valueOfrblques17);
bundle.putString("rbqs18Value", valueOftxtques18);
intent.putExtras(bundle);
startActivityForResult(intent, 1);
setResult(1,intent);
break;
A wiser move, might be passing the id of that database row to the next Activity.
And your code is incomplete, but it looks like only the last row's data will ever be passed to the next activity.
Also, it might be mildly more efficient and clear if you just putExtra directly into the intent instead of the intermediary Bundle.
Good practices said to include the package name as a prefix in the extra names.