i'm trying to write text on a bitmap and i need a edittexr in order to check inputs from keyboard . i find this code for draw EditText on the Canvas but it return null:

Attempt to invoke virtual method 'void android.widget.EditText.setDrawingCacheEnabled(boolean)' on a null object reference

Edit: Full class

public class TextMenu {
 private final Toolbox toolbox;
 private final AppPanel appPanel;
 private final Context context;
 private final MainActivity mainActivity;
 private final Resources resources;
 private Bitmap textTool, Click, textPlace;
 private final float xscaleFactor, yscaleFactor;
 private boolean allowDraw;
 private EditText editText; 

public TextMenu(Context context, Resources resources, float xscaleFactor, float yscaleFactor, Toolbox toolbox, AppPanel appPanel, MainActivity mainActivity) {
    this.xscaleFactor = xscaleFactor;
    this.yscaleFactor = yscaleFactor;
    this.resources = resources;
    this.toolbox = toolbox;
    this.appPanel = appPanel;
    this.context = context;
    this.mainActivity = mainActivity;

    textPlace = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(resources, R.drawable.text_place), (int) (xscaleFactor * 93), (int) (yscaleFactor * 193), true);
    textTool = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(resources, R.drawable.text_menu), (int) (xscaleFactor * 480), (int) (yscaleFactor * 100), true);
    Click = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(resources, R.drawable.tools_click), (int) (xscaleFactor * 80), (int) (yscaleFactor * 80), true);

    EditText editText;
    editText = new EditText(context);
    editText.setText("My Text");


public void draw(Canvas canvas) {
    if (allowDraw) {
        canvas.drawBitmap(textTool, 0, screenH - textTool.getHeight(), null);
//            editText.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
//                    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
            Bitmap b = editText.getDrawingCache();
            canvas.drawBitmap(b, 100, 100, null);
            // editText.draw(canvas);

how can i do that?

I want design about google places app, But source code still not working, I not sure what's happen, Is can any one can give some suggest?

  1. I have add some compile: compile 'com.android.support:appcompat-v7:25.0.0' compile 'com.google.android.gms:play-services:9.8.0' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:7.0.0'

  2. MapsActivity

public class MapsActivity extends AppCompatActivity {

PlacesTask placesTask;
EditText etxtPlaces;
ListView listViewPlaces;
PlaceAdapter adapter;
protected void onCreate(Bundle savedInstanceState) {
    try {
    } catch (Exception e) {

private void initializeControls(){
    try {
        etxtPlaces = (EditText)findViewById(R.id.etxtPlaces);
        listViewPlaces = (ListView)findViewById(R.id.listViewPlaces);
    } catch (Exception e) {

private void handleTextChangeListner(){
    try {
        etxtPlaces.addTextChangedListener(new TextWatcher() {

            public void onTextChanged(CharSequence s, int start, int before, int count) {


            public void beforeTextChanged(CharSequence s, int start, int count,
                                          int after) {

            public void afterTextChanged(Editable s) {
                // TODO Auto-generated method stub
                placesTask = new PlacesTask();
    } catch (Exception e) {

private class PlacesTask extends AsyncTask<String, Void, String>{

    protected String doInBackground(String... place) {
        // For storing data from web service
        String data = "";
        try {

            // Obtain browser key from https://code.google.com/apis/console
            String key = "key=AIzaSyAXcMjXOjzo2ui5BQMlB8LOltUMJ5HbBW4";
            String input="";
            input = "input=" + URLEncoder.encode(place[0], "utf8");
            // place type to be searched
            String types = "types=geocode";

            // Sensor enabled
            String sensor = "sensor=false";

            // Building the parameters to the web service
            String parameters = input+"&"+types+"&"+sensor+"&"+key;

            // Output format
            String output = "json";

            // Building the url to the web service
            String url = "https://maps.googleapis.com/maps/api/place/autocomplete/"+output+"?"+parameters;
            try {
                data = downloadUrl(url);
            } catch (IOException e) {
        } catch (UnsupportedEncodingException e) {
        return data;

    protected void onPostExecute(String result) {
        try {
        } catch (Exception e) {

private void parseAndBindDataToListview(String result){
    try {
        JSONObject jsonObject2 = new JSONObject(result);
        JSONArray array = jsonObject2.getJSONArray("predictions");
        JSONObject[] jsonObject = new JSONObject[array.length()];
        for (int i = 0; i < array.length(); i++) {
            jsonObject[i] = array.getJSONObject(i);

        adapter = new PlaceAdapter(MapsActivity.this, R.layout.place_list_row, jsonObject);
    } catch (Exception e) {

/** A method to download json data from url */
private String downloadUrl(String strUrl) throws IOException{
    String data = "";
    InputStream iStream = null;
    HttpURLConnection urlConnection = null;
        URL url = new URL(strUrl);

        // Creating an http connection to communicate with url
        urlConnection = (HttpURLConnection) url.openConnection();

        // Connecting to url

        // Reading data from url
        iStream = urlConnection.getInputStream();

        BufferedReader br = new BufferedReader(new InputStreamReader(iStream));

        StringBuffer sb  = new StringBuffer();

        String line = "";
        while( ( line = br.readLine())  != null){

        data = sb.toString();


    }catch(Exception e){
        Log.d("Exception while downloading url", e.toString());
    return data;



 public class PlaceAdapter extends ArrayAdapter<JSONObject> {
private Context context;
private int textViewResourceId;
private JSONObject[] data;
public PlaceAdapter(Context context, int textViewResourceId, JSONObject[] objects) {
    super(context, textViewResourceId, objects);
    this.context = context;
    this.textViewResourceId = textViewResourceId;
    data = objects;

public View getView(int position, View convertView, ViewGroup parent) {
    Viewholder holder = null;
    try {
            holder = new Viewholder();
            LayoutInflater inflater = (LayoutInflater) context
            convertView = inflater.inflate(textViewResourceId, parent, false);
            holder.txtPlace = (TextView) convertView.findViewById(R.id.txtPlace);

    } catch (Exception e) {

    return convertView;

static class Viewholder{
    TextView txtPlace;


  1. Android

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission     android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
        android:value="AIzaSyAXcMjXOjzo2ui5BQMlB8LOltUMJ5HbBW4" />
        android:value="@integer/google_play_services_version" />

How do i change the color of the selected day and circle in a Date Picker? I have tried several properties that are listed on the documentation, however i have had no success.

This is what i mean

I made a custom style for my Date Picker.

<style name="datePickerTheme">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="android:colorButtonNormal">@color/colorAccent</item>
        <item name="android:calendarTextColor">@color/colorAccent</item>
        <item name="android:headerBackground">@color/background</item>
        <item name="android:datePickerMode">calendar</item>

I just cant find the correct property to change the colors that i want.

Using Apple's Metal how do I access nested struct.

I can do the following.


struct Point
    var x:Float = 0
    var y:Float = 0
    var value:Float = 0

This is passed to Metal via device?.newBufferWithBytes.

In Shader.metal I have.

struct Point
    float x;
    float y;
    float value;

Usage of the struct in Shader.metal is easy.

point[0].value = newValue;

But how do I access the nested struct, for example children in Metal.


struct Child
    var x:Float = 0
    var y:Float = 0

struct Point
    var x:Float = 0
    var y:Float = 0
    var value:Float = 0
    var children = [Child]()

I'm new to iOS developing, I'm developing an app that requires to play RTMP live stream, I'm developing with swift. Can any one recommend for me an effective way to do that?

my microsoft 540 is refusing to download whatsapp attachments such as pictures, audio,documents e.t.c over mobile data but data settings are in place and texts are received.

I am trying to develop a scanner that can scan a page of a Passport with the android camera.

So from a Passport page like this: Sample passport

I'd like to crop out the marked part.

I have written code for edge detection using OpenCV which finds the contours and then finds the largest quadrilateral. Finally it does a 4 point perspective transformation to get a top view of the image. The edge detection works for images that have 4 distinguishable edges but not working for passports as it can detect only 3 approximately straight edges. I have tried drawing the top edge of the bounding rect of the largest contour in the image to obtain the 4th edge. But that messes up the perspective transformation. And it requires a fixed camera and document orientation (landscape) which I'd like to avoid.

Here is a sample input image (obtained from Google image search)

Sample 1

I'm trying to improve my understanding and ability to write code that uses recommended principles and practices, such as the SOLID principles. To do this, I am implementing the fireworks card game Hanabi.

Hanabi has two deck types, Standard and Advanced (which has an extra set of MultiColour cards). Each card in a deck I'm using a DeckFactory to construct a Deck. I'm looking for feedback on how the code structure could be improved, mostly around the relationship between how the Deck class and how the two derived classes (StandardDeck and AdvancedDeck) relate to each other, and their construction using the DeckFactory.

One of my concerns is that AssembleDeck (in the parent Deck class) needs to be called from each derived class and whether it should be in the Deck class at all.

A second concern is the use of a Stack to hold the cards; it is more appropriate for drawing a card from the deck, but maybe less so for when the deck is shuffled. I'm thinking of using the Fisher-Yates algorithm for shuffling.

I'm also wondering if there is anything in the code structure that needs to be changed so that unit tests are easier to write.

The card object:

public enum Suit { White, Red, Yellow, Green, Blue, MultiColour }
public enum Number { One, Two, Three, Four, Five }

public class FireworksCard {
    public Suit Suit { get; }
    public Number Number { get; }

    public FireworksCard(Suit suit, Number number) {
        Suit = suit;
        Number = number;

The Deck structure:

public interface IDeck {
    FireworksCard DrawCard();
    void Shuffle();

public abstract class Deck : IDeck {
    protected Stack<FireworksCard> Cards;

    public bool IsEmpty => !Cards.Any();

    public abstract IEnumerable<Suit> Suit { get; }
    public abstract IEnumerable<Number> Numbers { get; }

    protected void AssembleDeck() {
        Cards = new Stack<FireworksCard>();

        // generate a card for every combination
        foreach (var number in Numbers) {
            int cardRepetitions = GetCardRepetitions(number);

            for (int i = 0; i < cardRepetitions; i++) {

    private int GetCardRepetitions(Number number) {
        switch (number) {
            case Number.One:
                return 3;
            case Number.Five:
                return 1;
                return 2;

    private void GenerateAllSuitsForNumber(Number number) {
        foreach (var suit in Suits) {
            Cards.Push(new FireworksCard(suit, number));

    public void Shuffle() {
        // Randomly rearrange the order of Cards

    public FireworksCard DrawCard() {
        return Cards.Pop();

public class StandardDeck : Deck {
    public override IEnumerable<Suit> Suits => Enum.GetValues(typeof(Suit)).Cast<Suit>().Except(new[] { Suit.MultiColour });
    // What's better, this (Number[])Enum.GetValues(typeof(Number)); or this
    public override IEnumerable<Number> Numbers => Enum.GetValues(typeof(Number)).Cast<Number>();

    public StandardDeck() {

public class AdvancedDeck : Deck {
    public override IEnumerable<Suit> Suits => Enum.GetValues(typeof(Suit)).Cast<Suit>();
    public override IEnumerable<Number> Numbers => Enum.GetValues(typeof(Number)).Cast<Number>();

    public AdvancedDeck() {

The Deck factory:

public enum GameType { Standard, Advanced }

public class DeckFactory {
    public IDeck BuildDeck(GameType gameType) {
        switch (gameType) {
            case GameType.Standard:
                return BuildStandardDeck();
            case GameType.Advanced:
                return BuildAdvancedDeck();

    private IDeck BuildStandardDeck() {
        return new StandardDeck();

    private IDeck BuildAdvancedDeck() {
        return new AdvancedDeck();

Ive written a simple program in Python to calculate stellar distances , although by manually solving the algorithm I get the value accurately , but when I run the program the value I get is of this sort, for ex - for star proxima centuria the distance is 4.2 lightyears and the value I get by solving the algorithm is about the same but when I run the program the output I get is -3.15759630271859e-05 .how do I convert this value to float, or decimal

I want to license my Minecraft mod with WTFPL. However, I have a small section of code which I incorporated from other mod, licensed under GPL, in the first release of my mod.

In the recent version (see dev branch of my mod) I refactored and rewrote it from scratch. I also got permission (see README of my mod) from the author of the other mod to use his code.

In this situation, do I have a freedom over choosing which license I can choose, in this case WTFPL, or must I stick only to GPL compatible licenses?

I'm still going to give credit to the original author of the mod, but I'm unsure about my licensing situation and control over my code.

Thank you for attention!

I want to run my app on my device as debug I got this error :

Error:Execution failed for task ':nutella:transformJackWithJackForDebug'.
> com.android.build.api.transform.TransformException: com.android.jack.api.v01.ConfigurationException: Property 'jack.classpath': element #2: The version of the library file 'E:\Users\Masoud\AndroidStudioProjects\nutella\build\intermediates\transforms\preJackRuntimeLibraries\debug\jars\8000\40\android-987d2918fd65b5e5cc308d45e7d12f45b525eb9f.jar' is not supported anymore. Library version: 3.1 - Current version: 3.2 - Minimum compatible version: 3.2

my gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.3'

    defaultConfig {
        applicationId "*.*.*"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        jackOptions {
            enabled true
        // Enabling multidex support.
        multiDexEnabled true
    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    dexOptions {
        javaMaxHeapSize "2g"
        incremental true
        preDexLibraries = false
repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url 'https://raw.github.com/felipecsl/m2repository/master' }
  //  maven { url "https://jitpack.io" }

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.github.florent37:materialviewpager:1.2.0@aar') {
        transitive = true
    compile files('libs/volley.jar')
    compile files('libs/gson-2.2.4.jar')
    compile files('libs/AndroidViewAnimations-1.1.3.jar')
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:cardview-v7:23.+'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
    compile 'com.github.carlonzo.stikkyheader:core:0.0.3-SNAPSHOT'
    compile 'com.alexvasilkov:foldable-layout:1.2.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.alexvasilkov:android-commons:1.2.4'
    compile 'com.melnykov:floatingactionbutton:1.0.7'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.github.FuckBoilerplate:RxPaparazzo:0.1.0'
    compile 'io.reactivex:rxjava:1.1.5'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.google.android.gms:play-services-maps:9.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    testCompile 'junit:junit:4.12'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.android.gms:play-services-location:9.4.0'
    compile 'com.akexorcist:googledirectionlibrary:1.0.4'
  //  compile 'com.github.chrisbanes:PhotoView:1.2.4'

I'm trying to make my own shader to use as an SKShader for an SKSpriteNode, but I just don't know the proper way to do it. All I want is a way to write the shader code with autocompletion and to see the shader without having to wait ages for some huge program to compile it, but it seems to be more difficult than I thought.

I've already installed GLFW3 and a couple of other odd things since most tutorials suggest something like this for using OpenGL, but it seems to be more for OpenGL as a whole, rather than just one specific kind of shader.

TL;DR: Does anyone know a fast and simple way to write shaders to use as SKShaders in SpriteKit?

Coming from .Net, I am trying to learn Swift3/iOS and got puzzled by the following apparent inconsistent behaviour of optional protocol members. I suspect its something got to do with the juggling between objc/swift words, but what am I missing here actually?

// In playground, given below:

@objc protocol SomePtotocol {
    @objc optional func someMethod()

class SomeDelegate: NSObject, SomePtotocol {

class SomeController: NSObject {
    var delegate: SomePtotocol = SomeDelegate()

// This works and compiles without error

let controller = SomeController()
controller.delegate.someMethod?()      // No error, typed as '(() -> ())?'

// But this fails to even compile ??

let delegate = SomeDelegate()
delegate.someMethod?()  // Error: 'SomeDelegate' has no member 'someMethod'

I would expect either both to fail or both pass, so if someone could please enlighten me on this anomaly.

My variables does not seem to be passed through to the included layout.

My root layout:

<?xml version="1.0" encoding="utf-8"?>




        <include layout="@layout/included_layout" bind:viewModel="@{viewModel}"/>

My included layout:

<?xml version="1.0" encoding="utf-8"?>




            android:text="Some text"
            android:onClick="@{() -> viewModel.clickTest()}"/>

My variable

public class ExampleViewModel {
    public void clickTest() {
        Log.i(getClass().getSimpleName, "Test");

What am I missing?

In the game I am working on there is a Match object and a Player object.

The game is divided into different Matches (basically a lobby). Every Player needs to be in a Match but cannot be in several Matches at once.

Match contains the method List<Player> getPlayers() (list of players connected to the match). Player contains the method Match getMatch() (instance of match the player is connected to).

I have been struggling on where the information that says which Player is in which Match.

  • If the Match keeps a list of the players connected to that match, the Player.getMatch() method would have to loop through a MatchManager.getMatches() method to try to find the match that contains the Player instance.

  • If the Player keeps a reference to the Match it is connected to, the Match.getPlayers() method would have to loop through a PlayerManager.getPlayers() method to find every single Player that is connected to that match.

  • If the Match object keeps a list of connected Players and the Player object keeps a reference to the Match object it is connected to, neither Match.getPlayers() nor Player.getMatch() have to loop through a global list but can just return their reference. However, I feel this is very prone to errors as it could be easy for the references to get de-synced and not match up with the "Player must be in exactly one Match" assertion.

I am unsure which approach would be appropriate. It feels like I'm doing something else wrong with my entire code layout that this becomes a problem and that the entire Manager pattern is a bit of an anti-pattern but I'm not sure how to layout my code.

Any tips or thoughts about how I should be thinking about this (and similar code layout questions) would be greatly appreciated.

Not sure if this is appropriate in softwareengineering but I am not sure where the best place to ask for coding practises is.

I have a Raspberry Pi 3 (RPi) running an Icecast Server on port 8000 under Raspian Jessie. The RPi doesn't and shouldn't have a connection to the Internet. The only active interfaces are wlan1 (external USB-WLAN) running as WLAN-AP with hostapd and udhcpd as DHCP Server and eth0 for maintenance. Both interfaces have static IPv4 addresses in different IP-ranges. All incoming tcp requests on port 80 (HTTP) are redirected to port 8000 via iptables. This works. dnsmasq is configured to redirect all lookups to This works perfectly, typing in any url in the browser of the client device and he gets redirected to the Icecast Server status page.
But this works only, if the WLAN clients, e.g. android or iOS smartphones are not connected to the internet via celluar network (UMTS, LTE etc.) at the same time. If they are connected to the Internet, their smartphone routes them via their cellular modem to the Internet. They would have to put in the IP-Address or hostname of the RPi3 in order to get to the Icecast status page. For this project, I want all WLAN client devices, even if they are connected to Internet simultaneously, to get redirected to the Icecast status page.
I thought this could be achieved by running a captive portal. I've mirrored the http://www.apple.com/library/test/success.html to the corresponding directory relative to the root directory of the Icecasts webserver in order fake the WISPR internet connectivity check of iOS devices (http://blog.erratasec.com/2010/09/apples-secret-wispr-request.html). Yet, I don't' know if this works, 'cause I don't have an iOS device myself. I'll be able to test the system with an iOS device on November 7th.
Anyway, I'm looking for a general solution, which works with android an all other network devices as well. Is their a way to achieve this? The perfect solution would be: Client connects to the WLAN and the webbrowser pops up automatically with the Icecast status page. I've experienced this behavior when logging in to captive portals, but I dont know if this works, if there is an Internet connection at the same time. Because this is a very special project design, users cannot be informed about the fact, that they have to turn off their cellular Internet connection in order to get to the Icecast server via WLAN. Backup solution would be trying to ask them by using the SSID of the WLAN to turn of their cellular Internet connection (e.g. SSID:"projectname-Turnoff-mobile-internet"
Any help or ideas would be much appreciated!

My application is having trouble locating the files that are in the music folder on my iPhone.

If the files are held below as application data (in my playpen), no problem. But when I go looking for the "Music" folder), using the following lines

    dest_dir = try! FileManager.default.url(for: .musicDirectory, in: .allDomainsMask, appropriateFor: nil,  create: false)

    musicDir = dest_dir

    if UIApplication.shared.canOpenURL(musicDir) {
        print("found music directory")
    }else {
        print("did not find music directory")

When the code executes the canOpenURL, I get a permissions complaint.

I also tried accessing the user directory (thinking I could then navigate into Music).

Any clues on how an application can access the files and playlists held under the music system folder on the iPhone.

Thank you for you time and consideration.

Is there a way to disable the force requirements set back app when applying a sign profile?

I have a recycler view containing a bunch of images. When I tap on one of them a detail activity is launched, transitioning the image. My problem is that while the animation is running the image view turns white for a moment which doen't look good. I'm using Glide to load the images if that matters. Thank you in advance!

I have an app with 3 tabs. In the Tab1 I have a listview with a cursor adapter, in Tab2 and Tab3 I have only some Textviews.

The problems happens when I put code to filter the listview and next, I click randomly in the tabs. When I come back to Tab1 with Listview I get the error.

I tracking the problem and it is at setFilterQueryProvider. If I get rid off the filter all works well. What am I doing wrong ?

The error is:

D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: net.techabout.medappointment, PID: 10716
                  android.database.StaleDataException: Attempting to access a closed CursorWindow.Most probable cause: cursor is deactivated prior to calling this method.
                      at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:139)
                      at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
                      at android.database.CursorWrapper.getString(CursorWrapper.java:137)
                      at net.techabout.medappointment.AgendaCursorAdapter.bindView(AgendaCursorAdapter.java:86)
                      at android.support.v4.widget.CursorAdapter.getView(CursorAdapter.java:261)
                      at android.widget.AbsListView.obtainView(AbsListView.java:2346)

The error occurs in the adapter class:

   public void bindView(View view, Context context, final Cursor cursor) {
        ViewHolder viewHolder = (ViewHolder) view.getTag();

        String temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_INDICE)); //**Error here**

My fragment is:

public class AgendaMedFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
    private static final String TAG = AgendaMedFragment.class.getSimpleName();
    // These variables will hold the date values later
    AgendaCursorAdapter adapter;
    ListView listView;
    private int mPosition = ListView.INVALID_POSITION;
    private static final String SELECTED_KEY = "selected_position";

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.agendamedfrag, null);

        listView = (ListView) view.findViewById(R.id.list_cons);
        View v = (View) view.findViewById(R.id.empty_cons);
        adapter = new AgendaCursorAdapter(getActivity(), null,0);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
                mPosition = position;

        if (savedInstanceState != null && savedInstanceState.containsKey(SELECTED_KEY)) {
            mPosition = savedInstanceState.getInt(SELECTED_KEY);

        EditText myFilter = (EditText) view.findViewById(R.id.myFilter);
        myFilter.addTextChangedListener(new TextWatcher() {

            public void afterTextChanged(Editable s) {

            public void beforeTextChanged(CharSequence s, int start,
                                          int count, int after) {

            public void onTextChanged(CharSequence s, int start,
                                      int before, int count) {

         adapter.setFilterQueryProvider(new FilterQueryProvider() {

            public Cursor runQuery(CharSequence constraint) {
                Cursor cursor = getFilteredNames(constraint != null ? constraint.toString() : null);
                return cursor;


        return view;

    public Cursor getFilteredNames (CharSequence constraint)  {
        SQLiteDatabase mDB = DataProvider.getDB();
        SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();

        String asColumnsToReturn[] = {"*"};

        if (constraint == null  ||  constraint.length () == 0)  {
            //  Return the full list
            return queryBuilder.query(mDB, asColumnsToReturn, null, null,
                    null, null, DataProvider.COL_ID + " DESC");
        }  else  {
            String value = "%"+constraint.toString()+"%";
            return mDB.query(DataProvider.TABLE_AGENDA, asColumnsToReturn, "nome_cliente like ? ", new String[]{value}, null, null, null);

    public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
        CursorLoader loader = new CursorLoader(getActivity(),
                DataProvider.COL_ID + " DESC");
        return loader;

    public void onActivityCreated(Bundle savedInstanceState) {
        if (getLoaderManager().getLoader(0)==null) {
            getLoaderManager().initLoader(0, null, this);

    public void onLoaderReset(Loader<Cursor> loader) {

    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        if (mPosition != ListView.INVALID_POSITION) {

    public void onSaveInstanceState(Bundle outState) {
        if (mPosition != ListView.INVALID_POSITION) {
            outState.putInt(SELECTED_KEY, mPosition);

My Adapter is:

public class AgendaCursorAdapter  extends CursorAdapter {

    public static class ViewHolder {
        public final Button butDesmarcar;
        public final Button butVermapa;
        public final TextView mProtocolo;
        public final TextView mNomeCliente;
        public final TextView mNomeHosp;
        public final TextView mNomeMed;
        public final TextView mNomeConv;
        public final TextView mNomePlano;
        public final TextView mDatamarcada;
        public final TextView mHoraMarcada;

        public ViewHolder(View view) {
            butDesmarcar = (Button) view.findViewById(R.id.butdesmarcar);
            butVermapa = (Button) view.findViewById(R.id.but_ender_hosp_cons);
            mProtocolo = (TextView) view.findViewById(R.id.tvindice);
            mNomeCliente = (TextView) view.findViewById(R.id.tvnomecliente);
            mNomeHosp = (TextView) view.findViewById(R.id.tvnomehosp);
            mNomeMed = (TextView) view.findViewById(R.id.tvnomemed);
            mNomeConv= (TextView) view.findViewById(R.id.tvnomeconv);
            mNomePlano= (TextView) view.findViewById(R.id.tvnomeplan);
            mDatamarcada= (TextView) view.findViewById(R.id.tvdatamarcada);
            mHoraMarcada= (TextView) view.findViewById(R.id.tvhoramarcada);

    public AgendaCursorAdapter(Context context, Cursor c, int flags) {
        super(context, c, flags);

    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        int layoutId = R.layout.singlerowagenda;
        View view = LayoutInflater.from(context).inflate(layoutId, parent, false);

        ViewHolder viewHolder = new ViewHolder(view);

        return view;

    public void bindView(View view, Context context, final Cursor cursor) {
        ViewHolder viewHolder = (ViewHolder) view.getTag();

        String temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_INDICE));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_NOME_CLIENTE));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_NOME_HOSP));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_NOME_MED));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_NOME_CONV));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_NOME_PLANO));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_DATA_MARCADA));

        temp = cursor.getString(cursor.getColumnIndexOrThrow(DataProvider.COL_AG_HORA_MARCADA));

I work on an Android project, in which I use AsyncTask to send nameValuePairs to webservice. I use PHP code below to send data from application to database:


  $studentid = $_POST['name'];
  $classid = $_POST['classid']
  $studentid = $_POST['studentid'];
  $start = $_POST['start'];
  $end = $_POST['end'];
  $startsig = $_POST['startsig'];
  $endsig = $_POST['endsig'];

  $sql = "insert into signature (studentid,classid,start,end,startsig,endsig) values ('$studentid','$classid','$start','$end','$startsig','$endsig')";
    echo 'success';
    echo 'failure';

Values in dbConnect.php file are correct. Database schema looks like this. enter image description here

I checked, application sends out data successfully, but when I try to access PHP file above from browser I get a HTTP 500 error. What else should I check in this case?