|
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
|
|
|
|
|
I'm looking for a good, active Android discussion forum. I've been posting questions to Stack Overflow but traffic for Android is a lot slower there than, say, for Windows programming so many of my questions get no response. (e.g., )[This question about advancing the Month in CalendarView)]
This forum on codeproject only seems to average less than 1 new question a day. Android is such a dominant platform with so many developers, where do they all hang out?
NB that the Google+ "Android Developers" forum suggested in the Google documentation is very low traffic probably because it's swamped by spam and totally unmoderated (the have a moderator but he hasn't been there in a long time).
modified 10-Jun-16 12:34pm.
|
|
|
|
|
Most people hang out here because they think CodeProject is a great place, so they tend not to care too much about what other forums exist. If you want to research alternatives then Google is the tool of choice.
Or, you could just post a proper question.
|
|
|
|
|
A Google search is how I found this. So far, using Google, I haven't found much else but given how many apps are written for Android, they must be somewhere.
I included a link to my post on Stack Overflow in my question but since it's already been viewed there 21 times in the last 20 hours with no answers, and this is a lower-traffic forum, I wasn't optimistic about posting it here. But at your suggestion I'll try it.
|
|
|
|
|
Stackoverflow has a decent level of response for issues with code. For general assistance on Android - I personally use the Google+ communities feature as this is where the Google Android devs and experts appear to be most active. Some specific technologies are more organised and have a slack channel (e.g. firebase), but I have not found one better than Google+.
|
|
|
|
|
I have app in side it only one activity (main activity) and layout XML of main activity have only
list view .this app get restaurants near from my location and display it in list view
What i need to do is add button to the main activity layout when i press on button get to me list of restaurant item by item
from json file and display it in list view but not display all restaurants in one click but show item by item
every click get restaurant
suppose i have 3 restaurant in json file
when i click on button for first click get me first restaurant
when i click on button for second click get me second restaurant
when i click on button for third click get me third restaurant
How to customize this code to accept get item by item restaurant from json file
My code include class and activity and code is working success
my class is FoursquareVenue
package com.foodsmap_project_app.foodsmap_project_app;
public class FoursquareVenue
{
private String name;
private String city;
private String category;
public FoursquareVenue() {
this.name = "";
this.city = "";
this.setCategory("");
}
public String getCity() {
if (city.length() > 0) {
return city;
}
return city;
}
public void setCity(String city) {
if (city != null) {
this.city = city.replaceAll("\\(", "").replaceAll("\\)", "");
;
}
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
}
MainActivity.java
public class MainActivity extends ListActivity {
ArrayList<foursquarevenue> venuesList;
final String CLIENT_ID = "SVIBXYYXOEARXHDI4FWAHXGO5ZXOY204TCF1QJFXQLY5FPV4";
final String CLIENT_SECRET = "BAAJO1KXRWESGTJJGVON4W3WUFHAQDAJPLRIYJJ5OPHFQ5VI";
final String latitude = "30.435665153239377";
final String longtitude = "31.3280148";
ArrayAdapter <string> myAdapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new fourquare().execute();
}
private class fourquare extends AsyncTask<view, void,="" string=""> {
String temp;
@Override
protected String doInBackground(View... urls) {
temp = makeCall("https://api.foursquare.com/v2/venues/search?client_id=" + CLIENT_ID + "&client_secret=" + CLIENT_SECRET + "&v=20130815&ll=30.435665153239377,31.144435908398464" + "&query=resturant");
return "";
}
@Override
protected void onPreExecute() {
}
@Override
protected void onPostExecute(String result) {
if (temp == null) {
} else {
venuesList = (ArrayList<foursquarevenue>) parseFoursquare(temp);
List<string> listTitle = new ArrayList<string>();
for (int i = 0; i < venuesList.size(); i++) {
listTitle.add(i, venuesList.get(i).getName() + ", " + venuesList.get(i).getCategory() + "" + venuesList.get(i).getCity());
}
myAdapter = new ArrayAdapter<string>(MainActivity.this, R.layout.row_layout, R.id.listText, listTitle);
setListAdapter(myAdapter);
}
}
}
public static String makeCall(String url) {
StringBuffer buffer_string = new StringBuffer(url);
String replyString = "";
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(buffer_string.toString());
try {
HttpResponse response = httpclient.execute(httpget);
InputStream is = response.getEntity().getContent();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(20);
int current = 0;
while ((current = bis.read()) != -1) {
baf.append((byte) current);
}
replyString = new String(baf.toByteArray());
} catch (Exception e) {
e.printStackTrace();
}
return replyString.trim();
}
private static ArrayList<foursquarevenue> parseFoursquare(final String response) {
ArrayList<foursquarevenue> temp = new ArrayList<foursquarevenue>();
try {
JSONObject jsonObject = new JSONObject(response);
if (jsonObject.has("response")) {
if (jsonObject.getJSONObject("response").has("venues")) {
JSONArray jsonArray = jsonObject.getJSONObject("response").getJSONArray("venues");
for (int i = 0; i < jsonArray.length(); i++) {
FoursquareVenue poi = new FoursquareVenue();
if (jsonArray.getJSONObject(i).has("name")) {
poi.setName(jsonArray.getJSONObject(i).getString("name"));
if (jsonArray.getJSONObject(i).has("location")) {
if (jsonArray.getJSONObject(i).getJSONObject("location").has("address")) {
if (jsonArray.getJSONObject(i).getJSONObject("location").has("city")) {
poi.setCity(jsonArray.getJSONObject(i).getJSONObject("location").getString("city"));
}
if (jsonArray.getJSONObject(i).has("categories")) {
if (jsonArray.getJSONObject(i).getJSONArray("categories").length() > 0) {
if (jsonArray.getJSONObject(i).getJSONArray("categories").getJSONObject(0).has("icon")) {
poi.setCategory(jsonArray.getJSONObject(i).getJSONArray("categories").getJSONObject(0).getString("name"));
}
}
}
temp.add(poi);
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<foursquarevenue>();
}
return temp;
}
}
|
|
|
|
|
ahmed_sa wrote: What i need to do is add button to the main activity layout when i press on button get to me list of restaurant item by item from json file and display it in list view but not display all restaurants in one click but show item by item every click get restaurant Read the JSON file once into a container of some sort. When responding to a button click, read next item from container and add to listview's adapter.
ahmed_sa wrote: and code is working success So what's the 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
|
|
|
|
|
so that How to customize or modify this code to
Read the JSON file once into a container of some sort.by code
|
|
|
|
|
I already suggested this in your question below, including the sort of container you might consider to hold the JSON data.
|
|
|
|
|
Who can help me in customize that
please tell me site or forum
i will try to ask him
|
|
|
|
|
|
Are you a developer?
"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
|
|
|
|