Click here to Skip to main content
14,739,729 members

Comments by Member 10627743 (Top 54 by date)

Member 10627743 1-Jan-20 11:56am View
   
See the logcat details below
Member 10627743 1-Jan-20 11:56am View
   
Happy new year to everyone in the house

thanks for your swift response, during the process of debuging the app information below was shown in the logcat

Process: com.akinyemi.logicverse.giving, PID: 6189
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.akinyemi.logicverse.giving./com.akinyemi.logicverse.giving.MainActivity}: android.database.sqlite.SQLiteException: no such table: places (code 1 SQLITE_ERROR): , while compiling: SELECT pl_web_id FROM places ORDER BY pl_web_id DESC LIMIT 1
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2942)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3089)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6852)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:504)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.database.sqlite.SQLiteException: no such table: places (code 1 SQLITE_ERROR): , while compiling: SELECT pl_web_id FROM places ORDER BY pl_web_id DESC LIMIT 1
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:903)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:514)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)

Do you anyone have any idea or solution to the error, kindly help
Member 10627743 19-Aug-18 18:49pm View
   
Thank you originalgriff
Member 10627743 19-Aug-18 18:49pm View
   
Thanks Richard
Member 10627743 3-Apr-18 17:33pm View
   
Thanks david i will give it a try
Member 10627743 3-Apr-18 11:50am View
   
i want to play it in an android app
Member 10627743 31-Mar-18 7:53am View
   
dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// Glide library
compile 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
// Volley library
compile 'com.android.volley:volley:1.0.0'
// Recyclerview Library
compile 'com.android.support:recyclerview-v7:27.0.2'

}
Member 10627743 17-Aug-17 19:43pm View
   
Thanks Dave
Member 10627743 19-Sep-16 16:51pm View
   
Thanks Richard MacCutchan for your contribution i now get it
Member 10627743 19-Sep-16 12:09pm View
   
Hi David_Wimbley am sorry to ask because i have imported the required utils see below
import mp.MpUtils;
import mp.PaymentRequest;
import mp.PaymentResponse;
Member 10627743 16-Sep-16 7:53am View
   
Thank you Darren_vms
Member 10627743 17-Jul-16 8:51am View
   
Peter thank you for the reply but i tried the code below but still the button controls are not working

HTML
<div class="clear">
<button >Play Some Audio</button>
<br>
<button >Play Some Audio</button>
<br>
<button >Play Some Audio</button>

</div>

AudioInterface
//Pause an audio file from the webpage
@JavascriptInterface
public void pauseAudio(String aud) { //String aud - file name passed
//from the JavaScript function
final MediaPlayer mp;

try {
AssetFileDescriptor fileDescriptor =
mContext.getAssets().openFd(aud);
mp = new MediaPlayer();
mp.setDataSource(fileDescriptor.getFileDescriptor(),
fileDescriptor.getStartOffset(),
fileDescriptor.getLength());
fileDescriptor.close();
mp.prepare();
mp.pause();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Can you give an idea of how to implement this properly
Member 10627743 29-Jan-16 4:05am View
   
Thank you
Member 10627743 28-Jan-16 17:49pm View
   
Sascha thank you for your reply what about "the call is ambigous between the following properties and methods"
Member 10627743 18-Jan-16 7:14am View
   
I am developing for windows phone 8 i cant locate the web config
Member 10627743 28-Nov-15 14:16pm View
   
This is my registration.xaml below
<!--LayoutRoot is the root grid where all page content is placed-->
<grid x:name="LayoutRoot" removed="White">
<grid margin="5,0,0,0">
<grid.rowdefinitions>
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">

<!--Title-->
<textblock text="User Registration :" grid.row="0" fontsize="40" foreground="Black">

<!--UserName-->
<textblock text="UserName :" grid.row="1" foreground="Black" margin="0,25,0,0">
<textbox name="TxtUserName" borderbrush="LightGray" grid.row="1" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Password-->
<textblock text="Password: " grid.row="2" margin="0,25,0,0" foreground="Black">
<PasswordBox Name="TxtPwd" BorderBrush="LightGray" Grid.Row="2" Margin="100,0,0,0" GotFocus="pwd_GotFocus" />

<!--Address-->
<textblock text="Address: " grid.row="3" margin="0,25,0,0" foreground="Black">
<textbox name="TxtAddr" borderbrush="LightGray" grid.row="3" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Gender-->
<textblock text="Gender: " grid.row="4" margin="0,25,0,0" foreground="Black">
<radiobutton name="GenMale" removed="LightGray" content="Male" grid.row="4" margin="100,0,0,0" foreground="Black">
<radiobutton name="GenFeMale" removed="LightGray" content="Female" grid.row="4" margin="200,0,0,0" foreground="Black">

<!--Phone Number-->
<textblock text="Phone No: " grid.row="5" margin="0,25,0,0" foreground="Black">
<textbox name="TxtPhNo" borderbrush="LightGray" maxlength="10" inputscope="digits" grid.row="5" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Email-->
<textblock text="EmaiID: " grid.row="6" margin="0,25,0,0" foreground="Black">
<textbox name="TxtEmail" borderbrush="LightGray" grid.row="6" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Submit Button-->
<Button BorderBrush="Transparent" Background="#FF30DABB" Content="Submit" Name="BtnSubmit" Click="Submit_Click" Grid.Row="7"/>



I want the user details to be sent to email box
Member 10627743 28-Nov-15 14:13pm View
   
Deleted
this is my reg.xaml below
<!--LayoutRoot is the root grid where all page content is placed-->
<grid x:name="LayoutRoot" removed="White">
<grid margin="5,0,0,0">
<grid.rowdefinitions>
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">

<!--Title-->
<textblock text="User Registration :" grid.row="0" fontsize="40" foreground="Black">

<!--UserName-->
<textblock text="UserName :" grid.row="1" foreground="Black" margin="0,25,0,0">
<textbox name="TxtUserName" borderbrush="LightGray" grid.row="1" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Password-->
<textblock text="Password: " grid.row="2" margin="0,25,0,0" foreground="Black">
<PasswordBox Name="TxtPwd" BorderBrush="LightGray" Grid.Row="2" Margin="100,0,0,0" GotFocus="pwd_GotFocus" />

<!--Address-->
<textblock text="Address: " grid.row="3" margin="0,25,0,0" foreground="Black">
<textbox name="TxtAddr" borderbrush="LightGray" grid.row="3" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Gender-->
<textblock text="Gender: " grid.row="4" margin="0,25,0,0" foreground="Black">
<radiobutton name="GenMale" removed="LightGray" content="Male" grid.row="4" margin="100,0,0,0" foreground="Black">
<radiobutton name="GenFeMale" removed="LightGray" content="Female" grid.row="4" margin="200,0,0,0" foreground="Black">

<!--Phone Number-->
<textblock text="Phone No: " grid.row="5" margin="0,25,0,0" foreground="Black">
<textbox name="TxtPhNo" borderbrush="LightGray" maxlength="10" inputscope="digits" grid.row="5" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Email-->
<textblock text="EmaiID: " grid.row="6" margin="0,25,0,0" foreground="Black">
<textbox name="TxtEmail" borderbrush="LightGray" grid.row="6" margin="100,0,0,0" gotfocus="Txt_GotFocus">

<!--Submit Button-->
<Button BorderBrush="Transparent" Background="#FF30DABB" Content="Submit" Name="BtnSubmit" Click="Submit_Click" Grid.Row="7"/>



I want the user inputed details to be sent to my email account
Member 10627743 10-Aug-15 8:16am View
   
Can you give me brief sample on how to implement it
Member 10627743 17-Jul-15 7:52am View
   
I have been able to populate the listview through CSV and it's details displaying in a toast
Instead of displaying it in a toast how can it be displayed in an alert builder (dialog)
See my code below and full code here https://github.com/FoamyGuy/CSVListExample

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

/*
* Very basic Activity, the only things it does
* are get the ListView reference from our layout.
* Create an Adapter, set the Adapter to the ListView
* and handle the onItemClick events for when the user
* clicks on a row.
*/


public class MyActivity2 extends ActionBarActivity {

CSVAdapter mAdapter;
// Search EditText
EditText inputSearch;
private ArrayAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_activity2);

//Lookup our ListView
ListView mlist = (ListView)findViewById(R.id.mlist);

//Create Adapter. The second parameter is required by ArrayAdapter
//which our Adapter extends. In this example though it is unused,
//so we'll pass it a "dummy" value of -1.
mAdapter = new CSVAdapter(this, -1);

//attach our Adapter to the ListView. This will populate all of the rows.
mlist.setAdapter(mAdapter);


/*
* This listener will get a callback whenever the user clicks on a row.
* The pos parameter will tell us which row got clicked.
*
* For now we'll just show a Toast with the state capital for the state that was clicked.
*/
mlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<!--?--> parent, View v, int pos,long id) {
Toast.makeText(v.getContext(), mAdapter.getItem(pos).getCapital(), Toast.LENGTH_LONG).show(); //How to replace this with alertdialog builder
}
});

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

@Override
public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
// When user changed the Text
MyActivity2.this.mAdapter.getFilter().filter(cs);
}

@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub

}

@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
});
}




@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.my_activity2, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Member 10627743 29-Jun-15 10:08am View
   
Thank you Richard Deeming it worked
Member 10627743 13-Apr-15 14:12pm View
   
Am trying to render the questions in a string array is it possible to use superscript in string array
Member 10627743 9-Apr-15 5:45am View
   
I want to replicate the the menu bar in "apps for google" app
on windows phone store. http://www.windowsphone.com/en-us/store/app/apps-for-google/524e4c8c-5543-4cc2-9765-9a4f8bab397b[^] exactly the way it is done.

How can i replicate this in my app
Member 10627743 9-Apr-15 5:45am View
   
I want to replicate the the menu bar in "apps for google" app
on windows phone store. http://www.windowsphone.com/en-us/store/app/apps-for-google/524e4c8c-5543-4cc2-9765-9a4f8bab397b[^] exactly the way it is done.

How can i replicate this in my app

Member 10627743 16-Feb-15 5:02am View
   
Sorry for asking these questions because am still learning, can you point me to a tutorials that will allow me to store the pins with good security, because all the sqlite tutorials have seen does not show me how pre-store pins/password in the database, the user can only insert from the front end.
Member 10627743 16-Feb-15 4:42am View
   
is it possible for me to store multiple pins on this line of code "if (pin.getText().toString().equals("094523"))//More pins here"
Member 10627743 16-Feb-15 4:11am View
   
ok thank you very much for your time
Member 10627743 15-Feb-15 17:01pm View
   
Thank you for the reply i have read the stack trace i dont seem to find the solution this is the full stack trace kindly look at it

02-15 15:46:05.480 1147-1147/com.example.akinyemi.parselogintutorial E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.akinyemi.parselogintutorial, PID: 1147
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.akinyemi.parselogintutorial/com.example.akinyemi.parselogintutorial.MyActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.parse.ParseAnonymousUtils.isLinked(ParseAnonymousUtils.java:50)
at com.example.akinyemi.parselogintutorial.MyActivity.onCreate(MyActivity.java:26)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
02-15 15:45:59.200 1147-1147/com.example.akinyemi.parselogintutorial D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
02-15 15:46:05.270 1147-1147/com.example.akinyemi.parselogintutorial D/AndroidRuntime﹕ Shutting down VM
02-15 15:46:05.270 1147-1147/com.example.akinyemi.parselogintutorial W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb3a2aba8)
02-15 15:47:12.420 1147-1147/com.example.akinyemi.parselogintutorial I/Process﹕ Sending signal. PID: 1147 SIG: 9
device offline
Member 10627743 15-Feb-15 9:36am View
   
Thank you
Member 10627743 12-Feb-15 9:39am View
   
When i tried using the above in VS2012 for WP8 i got errors.
Is this format the same for windows phone

Kindly help
Member 10627743 9-Feb-15 10:34am View
   
Hi ryan i have did some improvement to the code, what i want to achieve is when the user select the date picker it shows data for desired day/date but it showing the present day only.

private List<devotion> devotions;

public CalendarPage()
{
InitializeComponent();

devotions = new List<devotion>();
AddDevotions();
}

private void pickerdt_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
{
DateTime dt = DateTime.Now;
int month = dt.Month;
int year = dt.Year;
int index;

if (DateTime.IsLeapYear(year) || (month <= 2))
{
index = dt.DayOfYear - 1; // list is indexed from 0
}
else
{
index = dt.DayOfYear; // add a day
}

textblock.Text = devotions[index].ToString(); // or some other property
}

private void AddDevotions()
{
for (int i = 1; i <= 366; i++)
{
string filePath = "MyDevotions/Devotion" + i.ToString() + ".json";
Devotion d = ReadJsonFile(filePath);
devotions.Add(d);
}
}

public Devotion ReadJsonFile(string JsonfilePath)
{
Devotion[] d = null;

using (StreamReader r = new StreamReader(JsonfilePath))
{
string json = r.ReadToEnd();
d = JsonConvert.DeserializeObject<devotion[]>(json);
}
return d[0];
}
Kindly help
Member 10627743 9-Feb-15 10:30am View
   
Am sorry for doing that
Member 10627743 9-Feb-15 9:18am View
   
when a user picks a date i want the date picker to automatically pick text file for that day from files stored in my fiolder
Member 10627743 6-Feb-15 8:32am View
   
WebBrowser.Source = new Uri(URLTextBox.Text, UriKind.Absolute);
Member 10627743 6-Feb-15 8:30am View
   
This line WebBrowser.Source = new Uri(URLTextBox.Text, UriKind.Absolute);
Member 10627743 4-Feb-15 16:00pm View
   
is still the same kindly help
Member 10627743 4-Feb-15 10:42am View
   
I have solved it thank you all for your time
I ticked the required capabilities in the manifest
Member 10627743 4-Feb-15 9:55am View
   
On this line "appointments.SearchAsync(DateBox.Value.Value, DateBox.Value.Value.AddDays(1), null);" of code
Member 10627743 3-Feb-15 9:15am View
   
Thank you RyanDev
Member 10627743 2-Feb-15 13:02pm View
   
Thank you richard Deeming the content of the text file has finally displayed in the emulator
Member 10627743 2-Feb-15 12:38pm View
   
When i added the code above i got the following error message "Error 1 'System.IO.File' does not contain a definition for 'ReadAllText'" kindly help
Member 10627743 2-Feb-15 12:35pm View
   
I have corrected the code but am still getting the same error, see the code below

public partial class MainPage : PhoneApplicationPage
{
List<string> devotions = new List<string>();

// Constructor
public MainPage()
{
InitializeComponent();

AddDevotions();
int index = DateTime.Now.DayOfYear;
textblock.Text = devotions[index];

// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
DateTime dt = DateTime.Now;
int month = dt.Month;
int year = dt.Year;
int index;

if (DateTime.IsLeapYear(year) || (month <= 2))
{
index = dt.DayOfYear - 1; // list is indexed from 0
}
else
{
index = dt.DayOfYear; // add a day
}

textblock.Text = devotions[index].ToString(); // or some other property
}


private void AddDevotions()
{
for (int i = 1; i <= 366; i++)
{
string filePath = "Devotions/Devotion1" + i.ToString() + ".txt";

devotions.Add(d);
}
}

public string ReadTextFile(string textFilePath)
{
string text = null;

using (StreamReader r = new StreamReader(textFilePath))
{
text = r.ReadToEnd();
}

return text;
}

public string d { get; set; }
Member 10627743 2-Feb-15 11:10am View
   
The error occur on the following line " textblock.Text = devotions[index].ToString(); // or some other property"
Member 10627743 24-Jan-15 9:53am View
   
they are in json format
Member 10627743 24-Jan-15 9:51am View
   
the files are in json format
Member 10627743 23-Jan-15 8:44am View
   
yes!!!
Member 10627743 20-Jan-15 9:27am View
   
Thank you i have fixed it
Member 10627743 20-Jan-15 9:26am View
   
Thank you i have fixed it
Member 10627743 20-Jan-15 9:26am View
   
Thank you i have fixed it
Member 10627743 19-Jan-15 7:54am View
   
I corrected the file path it shows another error below

+ $exception {Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'DevotionJson.Devotion' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<t> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at DevotionJson.MainPage.ReadJsonFile(String JsonfilePath)
at DevotionJson.MainPage.AddDevotions()
at DevotionJson.MainPage..ctor()} System.Exception {Newtonsoft.Json.JsonSerializationException}

What is the solution to this
Member 10627743 16-Jan-15 11:32am View
   
Hi
I am new to working with json kindly read
Let me tell you what i wanted to acheive. I am developing a daily devotional that has different devotion for each day. Instead of hard coding it i.e copy pasting for each day in the code, i want to store everything in json file in my project folder and refference it to appear in the textblock. Kiindly help this is my code without json reader or stream reader and how am i going to add json reader or stream reader into this code below

xaml


xaml
<scrollviewer>
<textblock x:name="textblock" textwrapping="Wrap" foreground="White">


xaml.cs
protected override void OnNavigatedTo(NavigationEventArgs e)
{
AddDevotions();
int index = DateTime.Now.DayOfYear;
textblock.Text = devotions[index];
}
List<string> devotions = new List<string>();
private void AddDevotions()
{
devotions.Add("4 Faith works miracles");
devotions.Add("5 Faith works miracles");
devotions.Add("6 Faith works miracles");
devotions.Add("7 Faith works miracles");
devotions.Add("8 Faith works miracles");
}

Thank you in advance and reply soon
Member 10627743 16-Jan-15 11:07am View
   
Hi Afzaal Ahmad Zeeshan

Sorry to bother you, i have changed all the extension see the code below

xaml.cs
//JSON starts here
public string ReadJsonFile(string JsonfilePath)
{
string strText = "This";

using (StreamReader r = new StreamReader("Assets/Dec1.json"))
{

string json = r.ReadToEnd();
dynamic array = JsonConvert.DeserializeObject(json);
//... read text from json file


}

return strText;

}

//Daily Devotion starts here
protected override void OnNavigatedTo(NavigationEventArgs e)
{

AddDevotions();
int index = DateTime.Now.DayOfYear;
textblock.Text = devotions[index];
}

List<string> devotions = new List<string>();
private void AddDevotions()
{
devotions.Add(ReadJsonFile("Assets/Dec1.json"));
devotions.Add(ReadJsonFile("Assets/Dec1.json"));
devotions.Add(ReadJsonFile("Assets/Dec1.json"));
}

What else am i doing wrong kindly help
Member 10627743 16-Jan-15 10:41am View
   
When i changed the file to .json this is the error given "An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code

If there is a handler for this exception, the program may be safely continued."

Kindly proffer a solution

Thank you
Member 10627743 16-Jan-15 10:41am View
   
Deleted
When i changed the file to .json this is the error given "An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code

If there is a handler for this exception, the program may be safely continued."

Kindly proffer a solution

Thank you
Member 10627743 16-Jan-15 8:27am View
   
Thank you for your reply, when i tried it this is the error it gave

"An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code

If there is a handler for this exception, the program may be safely continued."