|
|
Thank you,
But I checked the link common navigation pattern in the same page, but I didn't find any code, it is just an information.
Regards,
|
|
|
|
|
Yes, because it is just suggested patterns. You are expected to decide what you wish to implement and write the code yourself.
|
|
|
|
|
I would like to use Tab bar, so if I use deprecated interface, is there any problem?
|
|
|
|
|
aahamdan wrote: so if I use deprecated interface, is there any problem? I would assume it means you can't develop for Android 5 (API 21) or newer. If your target audience is older than that, you should have no problem.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
aahamdan wrote: is there any problem? There is only one way to find out.
|
|
|
|
|
Hello,
Can someone assist me with codes that I manipulates an android phone to take a vehicle number plate picture then extract the texts and maps it to the details of the registered owner.
Thanks in advance.
|
|
|
|
|
There are several libraries available for reading license plates. I used this one in my VanityPlates app. However, who that vehicle is registered to is not public information.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
can I in any way obtain such source codes in android?
|
|
|
|
|
To what exactly?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I designed app to make order for pizza food restaurant
I show userid,menu id ,address,longtiude,latitude then press on button make order
Error show after I press button and found in async task doin background
It give me fatal exception error
An error occurred while executing doInBackground()
and it show to me two lines have proplem
AddNewOrder.doInBackground(Summary.java:113)
AddNewOrder.doInBackground(Summary.java:77)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.json.JSONObject.getBoolean(java.lang.String)' on a null object reference
package com.pizza_final_project_app.pizza_final_project;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class Summary extends Activity {
SharedPreferences preferences;
private ProgressDialog pDialog;
//JSONParser jsonParser = new JSONParser();
boolean errorFound;
TextView textaddress;
TextView textlongtiude;
TextView textlatitude;
TextView text2;
TextView textuser;
Button btnorder;
private static final String TAG_SUCCESS = "success";
private static final String TAG = Summary.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_summary);
text2=(TextView)findViewById(R.id.textView3);
textaddress=(TextView)findViewById(R.id.textaddress);
textuser=(TextView)findViewById(R.id.textView4);
textlongtiude=(TextView)findViewById(R.id.textlongtiude);
textlatitude=(TextView)findViewById(R.id.textlatitude);
Intent i = getIntent();
String id = i.getStringExtra("Data4");
String address = i.getStringExtra("Data8");
String longtiude = i.getStringExtra("Data9");
String latitude = i.getStringExtra("Data10");
text2.setText(id);
textaddress.setText(address);
textlongtiude.setText(longtiude);
textlatitude.setText(latitude);
preferences= PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String email=preferences.getString("email","");
textuser.setText(email);
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
btnorder=(Button)findViewById(R.id.button2);
btnorder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
addOrder(textuser.getText().toString().trim(), text2.getText().toString().trim(),
textaddress.getText().toString().trim(), textlongtiude.getText().toString().trim(),
textlatitude.getText().toString().trim());
}
});
}
//line 77
class AddNewOrder extends AsyncTask<string, string,="" string=""> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(Summary.this);
pDialog.setMessage("Making Order...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected String doInBackground(String... args) {
final JSONParser jsonParser = new JSONParser();
// Building Parameters
List<namevaluepair> params = new ArrayList<namevaluepair>();
params.add(new BasicNameValuePair("userID", args[0]));
params.add(new BasicNameValuePair("menuID", args[1]));
params.add(new BasicNameValuePair("address", args[2]));
params.add(new BasicNameValuePair("longitude", args[3]));
params.add(new BasicNameValuePair("latitude", args[4]));
JSONObject jObj = jsonParser.makeHttpRequest(AppConfig.URL_Order,
"POST", params);
try {
//Line 113
boolean error = jObj.getBoolean("error");
if (!error) {
errorFound=false;
} else {
errorFound=true;
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String file_url) {
if (pDialog.isShowing()) {
pDialog.dismiss();
if (!errorFound){
Toast.makeText(getApplicationContext(), "User successfully registered. Try login now!", Toast.LENGTH_LONG).show();
Intent intent = new Intent(
Summary.this,
FinalResult.class);
startActivity(intent);
finish();
}
else{
Toast.makeText(getApplicationContext(), "An Error occoured!", Toast.LENGTH_LONG).show();
}
}
}
}
*/
private void addOrder(final String userID, final String menuID, final String address,
final String longitude, final String latitude) {
new AddNewOrder().execute(userID, menuID, address, longitude, latitude);
}
}
Class AppConfig
package com.pizza_final_project_app.pizza_final_project;
public class AppConfig {
public static String URL_Order = "http://amit-learning.com/myPizza/Api_v2.php?functi...";
json parser
package com.pizza_final_project_app.pizza_final_project;
import android.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;
public class JSONParser {
static InputStream is = null;
static JSONObject jObj = null;
static String json = "";
// constructor
public JSONParser() {
}
// function get json from url
// by making HTTP POST or GET mehtod
public JSONObject makeHttpRequest(String url, String method,
List<namevaluepair> params) {
// Making HTTP request
try {
// check for request method
if(method == "POST"){
// request method is POST
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}else if(method == "GET"){
// request method is GET
DefaultHttpClient httpClient = new DefaultHttpClient();
String paramString = URLEncodedUtils.format(params, "utf-8");
url += "?" + paramString;
Log.d("data",url);
HttpGet httpGet = new HttpGet(url);
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
Log.d("json","data is "+json);
} catch (Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
}
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// return JSON String
return jObj;
}
}
|
|
|
|
|
Post only relevant code next time.
The error text plainly states that jObj is null .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
to remove error what i make
|
|
|
|
|
don't forget: use "pre" tags to format it
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I have no intention of trying to plough through that unformatted code dump. However, it is highly likely that the following line did not return an object:
JSONObject jObj = jsonParser.makeHttpRequest(AppConfig.URL_Order, "POST", params);
|
|
|
|
|
I am new to android.I am trying to create a new project in eclipse.But it is not showing the create new android application in the new button.I need to click on the others.Also, when trying to create, I am getting the following errors(s).\
[2016-06-20 00:49:49 - Activitybasic] C:\Users\AKHIL\Documents\Android\Activitybasic\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:49:49 - Activitybasic]
[2016-06-20 00:49:49 - Activitybasic] C:\Users\AKHIL\Documents\Android\Activitybasic\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:49:49 - Activitybasic]
[2016-06-20 00:49:49 - Activitybasic] C:\Users\AKHIL\Documents\Android\Activitybasic\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 00:49:49 - Activitybasic]
[2016-06-20 00:49:49 - basics] C:\Users\AKHIL\Documents\Android\basics\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:49:49 - basics]
[2016-06-20 00:49:49 - basics] C:\Users\AKHIL\Documents\Android\basics\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:49:49 - basics]
[2016-06-20 00:49:49 - basics] C:\Users\AKHIL\Documents\Android\basics\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 00:49:49 - basics]
[2016-06-20 00:49:50 - testing] C:\Users\AKHIL\Documents\Android\testing\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:49:50 - testing]
[2016-06-20 00:49:50 - testing] C:\Users\AKHIL\Documents\Android\testing\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:49:50 - testing]
[2016-06-20 00:49:50 - testing] C:\Users\AKHIL\Documents\Android\testing\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 00:49:50 - testing]
[2016-06-20 00:53:26 - Activitybasic] C:\Users\AKHIL\Documents\Android\Activitybasic\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:53:26 - Activitybasic]
[2016-06-20 00:53:26 - Activitybasic] C:\Users\AKHIL\Documents\Android\Activitybasic\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:53:26 - Activitybasic]
[2016-06-20 00:53:26 - Activitybasic] C:\Users\AKHIL\Documents\Android\Activitybasic\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 00:53:26 - Activitybasic]
[2016-06-20 00:55:36 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:55:36 - test2]
[2016-06-20 00:55:36 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:55:36 - test2]
[2016-06-20 00:55:36 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 00:55:36 - test2]
[2016-06-20 00:55:38 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:55:38 - test2]
[2016-06-20 00:55:38 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 00:55:38 - test2]
[2016-06-20 00:55:38 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 00:55:38 - test2]
[2016-06-20 01:00:52 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 01:00:52 - test2]
[2016-06-20 01:00:52 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[2016-06-20 01:00:52 - test2]
[2016-06-20 01:00:52 - test2] C:\Users\AKHIL\Documents\Android\test2\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2016-06-20 01:00:52 - test2]
|
|
|
|
|
|
this is my database class when I access in Main activity then app stop working
please help me where am I am wrong
package com.example.nadeembhatti.ultimatesmsblocker;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class databaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME="SMS.db";
private static final String TABLE_NAME="B_LIST";
private static final String COL1="ID";
private static final String COL2="name";
private static final String COL3="number";
public databaseHelper(Context context) {
super(context, DATABASE_NAME, null, 2);
SQLiteDatabase db =this.getWritableDatabase();
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("Create Table "+ TABLE_NAME +"(ID integer primary key autoincrement, name text , number text);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS"+TABLE_NAME);
onCreate(db);
}
}
|
|
|
|
|
please post your stacktrace
|
|
|
|
|
List<ApplicationInfo> packages;
PackageManager pm;
pm = getPackageManager();
//get a list of installed apps.
packages = pm.getInstalledApplications(0);
ActivityManager mActivityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
for (ApplicationInfo packageInfo : packages) {
if((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM)==1)continue;
if(packageInfo.packageName.equals("mypackage")) continue;
mActivityManager.killBackgroundProcesses(packageInfo.packageName);
}
And permission kill
Why some app can't kill
Please help me how work????
|
|
|
|
|
So what's it (not) doing?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Android introduced a CalendarView back in in API 11. I've implemented it in my app and it seems to work fine in the sense that it displays a perfectly normal-looking whole-month calendar and I can select a date and it triggers the appropriate event and I can read the selected date in my code with no problem.
http://i.stack.imgur.com/8nh9V.jpg[screenshot]
But I can't advance it out of the current month! The documentation says
A user can select a date by taping on it and can scroll and fling the calendar to a desired date.
(the "taping" appears in the documentation; I assume it's a typo for "tapping" )
I've tried flinging, swiping, scrolling and nothing happens. Is there something I need to do to enable this feature?
My XML looks like this:
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="240dp" />
How do I advance the month on this? Thanks in advance!
|
|
|
|
|
I tried this on both an emulator and a real device. Scrolling worked as expected with no surprises.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Thanks for getting back to me. What kind of a device was it? I'm using a Samsung S Duos running Android 4.2.2. Is there any device setting that would disable "flinging" or horizontal scrolling? The calendar is in a layout with a bunch of other controls all in a ScrollView and the vertical scrolling works fine.
Unfortunately there's no easy way to test this in emulation because the app with the calendar is not stand-alone - it depends on other stuff happening on the phone that would be hard to do in emulation.
|
|
|
|
|
Member 12423805 wrote: The calendar is in a layout with a bunch of other controls all in a ScrollView... You need to isolate it to narrow down the problem. If it works being the only control in the layout, you then know where to focus your attention.
Member 12423805 wrote:
Unfortunately there's no easy way to test this in emulation because the app with the calendar is not stand-alone - it depends on other stuff happening on the phone that would be hard to do in emulation. Which is why you need to create a dummy app to test with.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|