NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.example.asusrog.papajohns;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.NumberPicker;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;

import com.squareup.picasso.Picasso;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;

import static com.google.android.gms.internal.zzip.runOnUiThread;

/**
* Created by dell on 12/28/2015.
*/
public class LstViewAdapter extends ArrayAdapter<String[]> {
private static String url = "http://tootbh.com/a_papa/getMenueById.php?id=";
// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_PRODUCTS = "menus";
private static final String TAG_PID = "id";
private static final String TAG_NAME = "name";
private static final String TAG_DATE = "_date";
private static final String TAG_PICTURE = "picture";
private static final String TAG_DESCRIPTION = "description";
private static final String TAG_RATING = "rating";
private static final String TAG_PRICE = "price";
String[] myM1;
TextView item;
ImageView itempic;
NumberPicker quntityPicker;
Button delBtn;
private final Context context;
SQLiteDatabase db;
ArrayList<String[]> list1 = new ArrayList<String[]>();

public LstViewAdapter(Context context, ArrayList<String[]> orders) {
super(context, R.layout.order_item, orders);
this.context = context;
this.list1 = orders;
}

public View getView(int position, View v, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View view = inflater.inflate(R.layout.order_item, parent, false);



final String pizzaID = list1.get(position)[0];
String size = list1.get(position)[1];
String type = list1.get(position)[2];
String quan = list1.get(position)[3];
String price = list1.get(position)[4];


//item=(TextView) v.findViewById(R.id.txt);
// itempic=(ImageView) v.findViewById(R.id.imageView);

quntityPicker=(NumberPicker) v.findViewById(R.id.numberPicker);

delBtn=(Button) v.findViewById(R.id.bt);

db = context.openOrCreateDatabase("papaJ", Context.MODE_PRIVATE, null);


quntityPicker.setValue(Integer.parseInt(quan));

new GetAsync().execute(pizzaID);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent next = new Intent(getContext(), PizzaActivity.class);
next.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// next.putExtra("id", id);
context.startActivity(next);
}
});


return view;
}

class GetAsync extends AsyncTask<String, String, String> {
// Creating JSON Parser object
JSONParser jsonParser = new JSONParser();
ArrayList<String[]> listM = new ArrayList<String[]>();
ArrayList<Bitmap> bitmapArray = new ArrayList<Bitmap>();


private ProgressDialog pDialog;

private static final String TAG_SUCCESS = "success";
// private static final String TAG_MESSAGE = "message";

JSONArray menus = null;


@Override
protected void onPreExecute() {
pDialog = new ProgressDialog(context);
pDialog.setMessage("Attempting login...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}



@Override
protected String doInBackground(String... args) {
JSONParser2 jParser = new JSONParser2();
JSONObject json = jParser.getJSONFromUrl(url+args[0]);
try {
// Getting Array of Contacts
menus = json.getJSONArray(TAG_PRODUCTS);


JSONObject c = menus.getJSONObject(0);
myM1 = new String[7];

myM1[0]= c.getString(TAG_PID);
myM1[1]= c.getString(TAG_NAME);
Log.d("text", myM1[1]);
myM1[2]= c.getString(TAG_PICTURE);
// myM1[3]= c.getString(TAG_DATE);
// myM1[4]= c.getString(TAG_RATING);
// myM1[5]= c.getString(TAG_DESCRIPTION);
// myM1[6]= c.getString(TAG_PRICE);





} catch (JSONException e) {
e.printStackTrace();
}

return null;
}

protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread

runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
// updating listview


// pidtv.setText( myM1[0]);
item.setText( myM1[1]);
// rate.setRating( Float.parseFloat(myM1[4]));
// Description.setText(Description.getText()+ myM1[5]);

// price.setText(price.getText() + myM1[6]);

Picasso.with(context)
.load("http://tootbh.com/a_papa/" + myM1[2])
.placeholder(R.drawable.common_google_signin_btn_icon_dark_pressed)
.error(R.drawable.cast_ic_notification_connecting)
.into(itempic);

}
});
}
}
}
     
 
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.