Working with Intents is difficult...
Do you really want to close the application?
</string>
<string name="error_dialog_connection_error">
- Connection error with MobAd server.
+ Connection error with MobiAd server.
</string>
<string name="error_dialog_userpwd_error">
The username or password you entered is incorrect.
<string name="button_login">Log In</string>
<string name="button_ok">OK</string>
<string name="button_cancel">Cancel</string>
-</resources>
\ No newline at end of file
+</resources>
// Create a new instance
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
- // Add a pattern that routes URIs terminated with "notes" to a NOTES operation
+ // Add a pattern that routes URIs terminated with "indexer" to a INDEXER operation
sUriMatcher.addURI("de.android.test3.provider", Indexer.Index.TABLE_NAME, INDEXER);
- // Add a pattern that routes URIs terminated with "notes" plus an integer
- // to a note ID operation
+ // Add a pattern that routes URIs terminated with "indexer" plus an integer
+ // to a index ID operation
sUriMatcher.addURI("de.android.test3.provider", Indexer.Index.TABLE_NAME + "/#", INDEXER_ID);
}
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
+import android.content.ContentUris;
+import android.net.Uri;
import android.net.http.AndroidHttpClient;
import android.util.Log;
JSONArray finalResult = new JSONArray(tokener);
for (int i = 0; i < finalResult.length(); i++) {
JSONObject objects = finalResult.getJSONObject(i);
- //Find out if that id is in the SQLite database.
+ IndexerProvider databaseIndexer = new IndexerProvider();
+ Uri.Builder prueba = new Uri.Builder();
+ prueba.encodedAuthority("de.android.test3.provider");
+ prueba.encodedPath("indexer");
+ prueba.appendQueryParameter("id", (String) objects.get("id"));
+ databaseIndexer.query(prueba.build(), null, null, null, null);
downloadAds((Integer) objects.get("id"), (String)objects.get("domain"), (String)objects.get("link"));
}
} catch (URISyntaxException e) {
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
+import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
CookieSyncManager.getInstance().sync();
//Go to the next activity
StrictMode.setThreadPolicy(currentPolicy);
- this.startActivity(new Intent(Intent.ACTION_RUN));
+ this.startActivity(new Intent(Intent.ACTION_RUN).
+ setComponent(new ComponentName("de.android.test3", "de.android.test3.NextActivity")));
} else {
Log.e(TAG, "There must be a weird issue with the server because... There is not cookie!!!!");
+ createErrorDialog(R.string.error_dialog_connection_error);
}
break;
case HttpStatus.SC_UNAUTHORIZED:
break;
default:
Log.e(TAG, "Error while retrieving the HTTP status line.");
- createErrorDialog(R.string.error_dialog_userpwd_error);
+ createErrorDialog(R.string.error_dialog_connection_error);
break;
}
}
else {
Log.e(TAG, "No response? This should never have happened.");
+ createErrorDialog(R.string.error_dialog_connection_error);
}
}