Thursday 30 May 2013

Handling CellForRowAtIndexPath Method not calling

Hi All,

In my application I used multiple  tableViews for eg: two. For the first table all delegate and datasource methods are called. When I add the second table and call the method
[self.tableView reloadData];
cellForRowAtIndex method is not called. In the second table, the number of sections is 1 and the number of rows is 5. I set the delegate and datasource for tableView programatically.

add the following asserts to your code (before the call to reloadData) and see what happens: NSAssert(self.tableView, @"No tableview"); NSAssert(self.tableView.dataSource, @"No datasource")

When NSAssert(self.tableView.dataSource, @"No datasource"); is crashing, you haven't set the dataSource of the tableView correctly.
The NSAssert will crash your app if the condition inside the parenthesis of the assert validates to false (or 0, or in this case nil).
Wherever you create your tableView, make sure that you set the dataSource (and probably delegate too) correctly.
Regarding setting the dataSource correctly, don't make the mistake to set the dataSource to a newly created instance of your viewController. Most likely you want to use self.tableView.dataSource = self;.


Solution:

If you are maintaing a multiple views & mulitple tableviews in single view controller, some times CellForRowAtIndexPath Method(DataSource Method) is not calling.


We can handle this by taking another view controller displaying the same class.
ChakriTableViewusingplist[1445:c07] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:1070
2013-05-30 12:08:51.779 ChakriTableViewusingplist[1445:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (9) must be equal to the number of rows contained in that section before the update (14), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(0x1c90012 0x10cde7e 0x1c8fe78 0xb63f35 0xb6b8d 0xc3846 0xc38c1 0x317d 0xd1384 0x20eb1b 0x10e1705 0x18920 0x188b8 0xd9671 0xd9bcf 0xd96a6 0x2a9f95 0x10e1705 0x18920 0x188b8 0xd9671 0xd9bcf 0xd8d38 0x4833f 0x48552 0x263aa 0x17cf8 0x1bebdf9 0x1bebad0 0x1c05bf5 0x1c05962 0x1c36bb6 0x1c35f44 0x1c35e1b 0x1bea7e3 0x1bea668 0x1565c 0x2342 0x2275)

libc++abi.dylib: terminate called throwing an exception



i got this error while i am editing the table view cells deleting the cell from table view

Wednesday 29 May 2013

Keep the screen to stay on(with out going to sleep mode) when i taking pictures from camera automatically with out userinterface.


Using PowerMAnager in Android we can keep the screen to stay on(with out going to sleep mode) when i taking pictures from camera automatically  with out userinterface.

PowerManager.WakeLock w1;
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
w1 = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
w1.acquire();
w1.release();

JSON array of objects


It can be a situation where you got a array of data that should be sent in the JSON format to server via ajax, then you can do the following

<script type="text/javascript" >
groups = ['A', 'B', 'C'];
users  = ['user1', 'user2', 'user3'];

//required format is  [{"group_name" : "A", "leader" : "user1"}, {"group_name" : "B", "leader" : "user2"}, {"group_name" : "C", "leader" : "user3"}]

group_leaders = new Array();

len = groups.length;

for(var i = 0; i < len; i++ ){
    group_leaders.push({"group_name" : groups[i], "leader" : users[i]});
}

alert(JSON.stringify(group_leaders));
</script>

Tuesday 28 May 2013


 Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.487 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.487 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.488 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.488 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.489 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.489 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.490 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.490 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.491 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.491 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.492 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.492 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.494 LearnEnglish[796:c07] Unbalanced calls to begin/end appearance transitions for 







i am getting this error while i am using navigation in view controllers.

Device Orientation Issue

Hi Team,

I have a issue when rotating the device . If device is in either LandScape Left/ Right or Portrait/Portrait up Side Down then navigation will be changed according to orientations. But device is either LandScape Left/ Right or Portrait/Portrait up Side Down means (like slight difference in angle of rotation.) . In that case, which direction can take the device either LandScape Left/ Right or Portrait/Portrait up Side Down?

 please find the below image:



Fig 1
 Thanks & Regards,
     R.Anusha

Saturday 25 May 2013

Hi all,

We have a small issue  in handling tableView dynamically.

When the view loads for first time,its working fine.But I need to reload the table data according to the data we get from web service in the same view.
But while reloading the table, section number is not updating.

For example if I have 9 sections in my table,

for the first time loading its updating from 0 to 8.
But while reloading the table, we are getting the section numbers as 8,0,1,2,3,4,5,6,7,8 instead of 0 to 8 so that we got all the sections of table  in interchanged manner.
Can anyone help me in this aspect?

Thanks,
Tejaswini.

Friday 24 May 2013

How to create a path variable in linux 
To avoid the regularly setting the path we can make a variable contains that path

this variable is path Variable.

Thursday 23 May 2013

Unable to execute dex: Java heap space

When i use the third party libraries i got this error in a dialog box, Unable to execute dex: Java heap space .

But i got the solution from stack overflow ,the process is
1. Right click on the project and move to properties ,select the Build Path.
2.Choose the Library then click Next
3.Select the Add Library then you get new window,select the User Library .Again you get new window and click User Libraries.
4.Click on the New button and enter the any name as library then click ok.
5.Select the newly added library and Click "Add Jar"
6.Click ok on the User Libraries dialog,and make sure that the you should check the Check Box in the Add Library dialog. 





to create the project in Sencha we need to follow these Steps 



1).Sencha command Should be Download and installed first.

2).download the touch 2.2.0  SDK and 


3).IN TERMINAL  Change the Directory to touch 2.2.0 
and write command.

iPap010s-iMac:touch-2.2.0 ipapstudent$  sencha generate app Myapp /Users/ipapstudent/Desktop/Myapp

1)command is  sencha generate app
2)parameters 
3)   .Myapp is projectname

4).the location where we want to store or created path of the project directory Users/ipapstudent/Desktop/Myapp



follow these steps 

Wednesday 22 May 2013



 Sencha is going to be Good Thing in Coming feature Full Fledged HTML5 Thing 

  it will run in only server installed on individual system that is XAMPP for running the sencha programs on any  individual machines.
  
 first thing we need to know About html5,Javascript and css3 and XAMPP server

  to create sample project in with sencha lib we need to do like same as cordova command like we have to do sencha upto now it is under developement the sdk tools are individually install and run some lttle bit confusing  

the IDE is not fully developed means we have individual tools for every part of  the project  developement like for UI Developement ,For Running,For Creating Project ,we need to install or know all tools in sdk
1).sencha SDK or Sencha Command .

2)sencha archietect,

3).xampp server 

These SDK's have to install in mac
or windows
  these sencha is not only for mac,windows also  ya thats it we can say cross plotform tools like phone gap,sencha . for any mobile  we can make applications 



sencha EXT JS is for Desktop or mac applications and 

Sencha Touch is for small screens like mobiles,tablets and ipod,ipads like


please feel free to share if any thing  went wrong.
ThankQ.

Tuesday 21 May 2013

Self Signed SSL Web Service not working for phonegap application in android after the Export the Signed app

The solution for this problem, we need to handle like,

In the main Activity,we need to add blue color content like as,


import org.apache.cordova.DroidGap;
import android.os.Bundle;

public class MyPhoneGapActivity extends DroidGap {



@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

               super.init();
               MyWebViewClient webViewClient = new MyWebViewClient(this);
       webViewClient.setWebView(this.appView);
       this.appView.setWebViewClient(webViewClient);


super.loadUrl("file:///android_asset/www/index.html");
}
}




We need to create the MyWebViewClient class and make the onReceivedSslError method ,it calls handler.proceed();Then https service callling working fine.



import org.apache.cordova.CordovaWebViewClient;
import org.apache.cordova.api.CordovaInterface;

import android.net.http.SslError;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;

public class MyWebViewClient extends CordovaWebViewClient {

    public MyWebViewClient(CordovaInterface cordova) {
super(cordova);
// TODO Auto-generated constructor stub
}


    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
        handler.proceed();
    }
}



Thank You

Sunday 19 May 2013

Exceptions in iOS


How to handle the exceptions in iOS?
Mainly Catch block, When the application going to catch block it gets hanged. How to rectify that problem?

Saturday 18 May 2013

1.How to Convert accelerometer values to angles and how to use Core motion of object using accelerometer?

Friday 17 May 2013

Is it possible to play the number of youtube urls one by one continuously on youtube in iOS?



I have the 5 videos for single product.So,I stored the 5 url's in an array for playing on you tube ,
And loading the urls using array index .
But  only last URL is playing on youtube .How can I Play the all urls one by one on youtube continuously?



for (int i = 0; i<[arrayOfURLs count]; i++)
 {
    NSString *strForvideo = [arrayOfURLs objectAtIndex:i];
    strForvideo = [strForvideo stringByReplacingOccurrencesOfString:@"http://youtu.be/" withString:@""];
    NSLog(@"temp str %@",strForvideo);
    NSMutableString * htmlCode = [NSMutableString stringWithString:@"<html><body><iframe frameborder=\"0\" width=\"450\" height=\"240\" src=\"http://www.youtube.com/embed/"];
    [htmlCode appendString:strForvideo];
    [htmlCode appendString:@"\""];
    [htmlCode appendString:@"</iframe></body></html>"];
     NSLog(@"YOU TUBE:%@",htmlCode);
    [self.webviewOverView loadHTMLString:[htmlCode description] baseURL:nil];
}


Please any one suggest me solution for this..


Thursday 16 May 2013

Errors running builder 'JavaScript Validator' on project 'PhoneGapActivity'. 11

Hi I got the JavaScript Validation problem in my Eclipse while executing the project.

The solution is,Go to the Project -->PropertiesàBulders then disable the “JavaScript Validator”.Then it is working fine.

How to play YouTube video on UIWebview in iOS Apps?

Hi All,

How to play a video on UIWebview in iOS Apps?

Sol:


NSString *htmlString = @"<body><iframe width=\"200\" height=\"150\" src=\"http://www.youtube.com/embed/zXf1zyKQ5Hw\" frameborder=\"0\" allowfullscreen></iframe></body>";      
   
/* passing the html string of corresponding video link from Youtube.*/

webView.delegate = self;
webView.opaque = YES;  /*(Yes Or No)*/ 
[webView loadHTMLString:htmlString baseURL:nil];
[self.view addSubView:
webView
];

Thanks & Regards,
R.Anusha

Wednesday 15 May 2013

Hi All,

 How to hide the tab bar in iPhone app or iPad app?
Sol:
You can make use of a property in UIViewController to hide the tab bar.
Please find the below link.

http://www.appcoda.com/ios-programming-101-how-to-hide-tab-bar-navigation-controller/

Thanks & Regards,
R.Anusha
Hi all,

We got  an issue in handling the image for navigation bar in iPad.

[self.navigationController.navigationBar setBackgroundImage:nil                        forBarMetrics:UIBarMetricsDefault];
 
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;

We wrote this code snippet in viewWillAppear: for setting nil to  navigation image in a view. 
We have also set nil image before pushing that viewController.

But we are getting an overlapping issue  of navigation bar titles  and navigation image while pushing the view for first time.
 For the next push onwards that is working fine.

For detailed reference Please find the screen shot and video link.

http://youtu.be/zNd9vpwDuAs

Thanks for help,
Tejaswini.S



Tuesday 14 May 2013

For programatically creating banners in landscape mode

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierLandscape];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
[self.view addSubview:adView];

 For Setting banner view sizes for ads in Landscape /Portrait mode in both iPhone and iPad  

Please visit :http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/iAd_Guide/BannerAdvertisements/BannerAdvertisements.html

Monday 13 May 2013

Dealing with the “Bitmap Size Exceeds VM Budget” error


One of the most common errors that I found developing Android Apps is the “java.lang.OutOfMemoryError: Bitmap Size Exceeds VM Budget” error. I found this error frecuently on activities using lots of bitmaps after changing orientation: the Activity is destroyed, created again and the layouts are “inflated” from the XML consuming the VM memory avaiable for bitmaps.
Bitmaps on the previous activity layout are not properly deallocated by the garbage collector because they have crossed references to their activity. After many experiments I found a quite good solution for this problem.
First, set the “id” attribute on the parent view of your XML layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:id="@+id/RootView"
>

Then, on the onDestroy()  method of your Activity, call the unbindDrawables() method passing a refence to the parent View and then do a System.gc().


@Override
protected void onDestroy() {
    super.onDestroy();
 
    unbindDrawables(findViewById(R.id.RootView));
    System.gc();
}
 
private void unbindDrawables(View view) {
    if (view.getBackground() != null) {
        view.getBackground().setCallback(null);
    }
    if (view instanceof ViewGroup) {
        for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
            unbindDrawables(((ViewGroup) view).getChildAt(i));
        }
        ((ViewGroup) view).removeAllViews();
    }
}



This unbindDrawables() method explores the view tree recursively and:
  • Removes callbacks on all the background drawables
  • Removes childs on every viewgroup.

Happy coding